steps[] = array($name,$arguments); } return $this; } public function doNext() { $this->pos++; $k = $this->pos; if(isset($this->steps[$k])) { $f = '_'.$this->steps[$k][0]; $args = $this->steps[$k][1]; // returns false if call_user_func_array encounters error $result = call_user_func_array(array($this,$f),$args); $this->lastStep = $this->steps[$k][0]; return $result; } else { return false; } } public function doAll() { while(($res = $this->doNext()) !== false) { $results[] = $res; } return $results; } } ?>