echo preg_replace("/f(o)o/", 'b$1r', 'This is foo.');
$var = ??? // here I want to get what $1 captured
For “built-in” I mean some PHP special variable, like Ruby’s $1.
If PHP hasn’t a proper way to get that, what is the best way to achieve it?
http://www.php.net/manual/en/function.preg-replace-callback.php