note 30048 added to function.str-replace
| From: | nimrod at rack1 dot php dot net | Date: | Wed, 05 Mar 2003 10:16:48 +0000 |
| Subject: | note 30048 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44855@lists.php.net to get a copy of this message | ||
I've been asked so many times - it has to be online:
When repalcing a string for a later use with JavaScript document.write use these:
str_repalce("\"", "\\\"", $str)
str_repalce("\'", "\\\'", $str)
str_repalce("\\", "\\\\", $str)
this will add \ before the otherwise problematic ", ', \
--
http://www.php.net/manual/en/function.str-replace.php
http://master.php.net/manage/user-notes.php?action=edit+30048
http://master.php.net/manage/user-notes.php?action=delete+30048
http://master.php.net/manage/user-notes.php?action=reject+30048