note 74409 deleted from function.preg-replace by colder

From: Date: Mon, 18 Jun 2007 20:10:26 +0000
Subject: note 74409 deleted from function.preg-replace by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-127722@lists.php.net to get a copy of this message
Note Submitter: commentgg NOSPAMAT hot mail . com ---- Important. When you have replacement text like this: $r='One $, $12.50 \\12.50 \\\\12.50 \1'; that enters: preg_replace('/pattern/',"replacement with $r in it",$text) The result is corrupted as $1 or \\1 type patternswill get replaced/removed. Solution (it seems): use this on $r: $r=str_replace(array('\\','$'),array('\\\\','\$'),$r);

« previous php.notes (#127722) next »