diff options
-rw-r--r-- | it_pipe.class | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/it_pipe.class b/it_pipe.class index c7ef023..3dbf313 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -2,6 +2,7 @@ class it_pipe implements Iterator { + static $lastargfunc = array('explode' => 1, 'preg_match' => 1, 'preg_split' => 1, 'it__match' => 1); /** * Creates a pipe object from input. Named arguments: @@ -25,10 +26,10 @@ function __construct($p = array()) # function __call($name, $params) { - array_unshift($params, ""); + list($parampos) = self::$lastargfunc[$name] ? array(count($params)) : array(0, array_unshift($params, "")); $func = ($t = it::match('(\w+)__(\w+)', $name)) ? array($t[0], $t[1]) : (method_exists($this, $name) ? array($this, $name) : $name); - foreach($this->lines as $i => $params[0]) + foreach($this->lines as $i => $params[$parampos]) $this->lines[$i] = call_user_func_array($func, $params); return $this; |