Re: how do I just escape double quotes within a string?
| From: | Eric Butera | Date: | Tue, 13 Feb 2007 17:14:34 +0000 |
| Subject: | Re: how do I just escape double quotes within a string? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-248813@lists.php.net to get a copy of this message | ||
On 2/13/07, blackwater dev <blackwaterdev@gmail.com> wrote:
If I use add slashes, it strips everything, I just want to replace all the double quotes with slash double quote but this, of course, throws errors: str_replace(""","\"",$code); Thanks!Try this $string = 'Hello "person." How are you?'; var_dump($string); var_dump(str_replace('"', '\"', $string)); Notice you can use single and double quotes in the same string.