note 50397 deleted from function.preg-replace by tularis
| From: | tularis@php.net | Date: | Sun, 18 Jun 2006 13:25:05 +0000 |
| Subject: | note 50397 deleted from function.preg-replace by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114306@lists.php.net to get a copy of this message | ||
Note Submitter: php at ihid dot co dot uk
----
In the function :
$xml = preg_replace("asd", "\$1".$text."\$2", $xml);
if text starts or finished with a number you will have unexpected behaviour.
If $text = "3asd" for instance, the function will be
$xml = preg_replace("asd", "\$13asd\$2", $xml);
Rather than trying to parse $1 like we want, it will try to use $13, giving a very different result.
Confused me for ages.