Re: preg_replace_callback

From: Date: Fri, 13 Jul 2001 05:17:51 +0000
Subject: Re: preg_replace_callback
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-59919@lists.php.net to get a copy of this message
On Thu, 12 Jul 2001, Wez Furlong wrote: > Hi Andrei (and anyone else in on pcre), > > This doesn't work as you might expect if you were used to preg_replace: > > preg_replace_callback( > array( ...patterns...), > array( ...callbacks...), > $subject); > > Instead, it expects a single callback as the second parameter. > > Any chance that it could be made to do so, or are there technical reasons > not to? Yes, there is a technical reason. It's the same reason that I split this functionality out into a separate function instead of continuing to use the /F modifier. The reason is that in order to call class methods you have to use array($obj, 'method') or array('class', 'method') syntax for callback and that quickly becomes ambiguous when trying to figure out if you were passed one callback or several. -Andrei

« previous php.dev (#59919) next »