note 9538 deleted from function.str-replace by philip
| From: | philip@php.net | Date: | Mon, 04 Feb 2002 12:42:47 +0000 |
| Subject: | note 9538 deleted from function.str-replace by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-26209@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..