note 14277 rejected and deleted from function.preg-replace.php by zak
| From: | zak@php.net | Date: | Wed, 25 Jul 2001 16:50:05 +0000 |
| Subject: | note 14277 rejected and deleted from function.preg-replace.php by zak | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15831@lists.php.net to get a copy of this message | ||
To fix hover@mi.ru's problem with preg_replace improperly handling escaped $'s ($), do
this:
$text = str_replace('$', '$', $text);
$string = preg_replace("/something/", $text, $string);
Then once you are done with the preg_replace's, do:
$string = str_replace('$', '$', $string);
otherwise all of your $'s will have an extra in front of them.
I realize this is weird and it shouldn't be this way, but it is a workaround.