calling function inside preg_replace thats inside a function
return preg_replace_callback("/\[video\](.+?)\[\/video\]/", 'embed_video', $Text);function embed_video($matches){ return $matches[1] . 'foo'; }
You can use the "e" modifier on preg_replace()
(see Pattern Modifiers)
return preg_replace("/\[video\](.+?)\[\/video\]/e", "embed_video('$1')", $Text);
which tells preg_replace()
to treat the second parameter as PHP code.