note 11459 added to preg_replace
| From: | netben at free dot fr | Date: | Wed, 21 Feb 2001 17:12:20 +0000 |
| Subject: | note 11459 added to preg_replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11361@lists.php.net to get a copy of this message | ||
you can't include array with a reference to a captured pattern as a key into the replacement
string.
for example:
preg_replace("/blabl(.*?)blo(.*?)/",$array[$1],$contents);
i tried with \\1 , no results.
with the \e modifier (blbla.$array[1].blbl) .
the solution was using /F modifier , and creating a special function...
http://www.php.net/manual/en/function.preg-replace.php