note 12737 rejected and deleted from function.preg-replace.php by zak
| From: | zak@php.net | Date: | Wed, 25 Jul 2001 16:49:54 +0000 |
| Subject: | note 12737 rejected and deleted from function.preg-replace.php by zak | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15830@lists.php.net to get a copy of this message | ||
The problem is that preg_replace ignores escaping of $nn sequence in the replacement string.
<?
$str = preg_replace("/a/", "$1000", "test ... a ... test");
echo $str;
?>
test ... 00 ... test
-----------
#!/usr/local/bin/perl -w
$_ = "test ... a ... test";
s/a/$1000/;
print;
-----------
test ... $1000 ... test
This feature leads to impossibility of passing strings like '$1000' via phplib template
variables.