note 9538 added to str_replace

From: Date: Thu, 09 Nov 2000 22:15:36 +0000
Subject: note 9538 added to str_replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-7553@lists.php.net to get a copy of this message
If you use str_replace() to manually do what addslashes() does, i.e. backslash-escape certain characters (I do that a lot, since I often need more characters escaped than what addslashes does, and in different ways than addcslashes), don't forget to escape the backslash itself FIRST, then everything else, e.g. $x = str_replace("\\", "\\\\", $x); $x = str_replace("\n", "\\n", $x); $x = str_replace("\000", "\\0", $x); etc.. http://www.php.net/manual/function.str-replace.php

« previous php.notes (#7553) next »