preg_replace and a function?
Posted: Thu May 25, 2006 12:36 pm
Code: Select all
$str = 'hello [i=55] this work?';
$str = preg_replace ('/\[i=(.*?)\]/is', workstuff($1), $str);A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
$str = 'hello [i=55] this work?';
$str = preg_replace ('/\[i=(.*?)\]/is', workstuff($1), $str);Code: Select all
$str = 'hello [i=55] this work?';
preg_match_all('/\[i=(.*?)\]/is', $str, $matches);
foreach ($matches[1] as $find) {
$str = preg_replace ('/\[i=' . $find . '\]/is', workstuff($find), $str);
}