note 14277 added to function.preg-replace.php

From: Date: Tue, 24 Jul 2001 23:13:51 +0000
Subject: note 14277 added to function.preg-replace.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-15798@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. http://www.php.net/manual/en/function.preg-replace.php

« previous php.notes (#15798) next »