In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Rafael Fernandes) wrote:

> First, sorry for my elementary english...
> I need a function made for PHP3 that works like preg_replace_callback...

Before preg_replace_callback() was introduced, preg_replace() used to have 
another an "f" modifier which had similar functionality.  I'm not sure 
whether that modifier was available back in PHP3, but here's the relevant 
quote about "f" from an old set of PCRE Syntax docs:

> F
> If this modifier is set, preg_replace() treats the replacement parameter as a 
> function name that should be called to provide the replacement string. The 
> function is passed an array of matched elements in the subject string. NOTE: 
> this modifier cannot be used along with /e modifier; and only preg_replace() 
> recognizes this modifier.

If I recall correctly (which I may not), an example would look something 
like this:

$output=preg_replace("/(\w+)/f","'***' . strtolower($1) . '***'",$input);

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to