Re: Strings with embedded quotes and double quotes
| From: | Richard Lynch | Date: | Wed, 03 Jul 2002 03:36:38 +0000 |
| Subject: | Re: Strings with embedded quotes and double quotes | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105122@lists.php.net to get a copy of this message | ||
>I need to echo a string that contains both quotes and double
>quotes.
>
>I remember doing this once using a special construct where the
>string started on a new line with a triple slash if I remember well. Or
>it was a triple something...
>
>I can't find the topic in the online PHP doc...
>
>Anybody remember this construct?
You are talking about "here docs":
It's something goofy like:
<<<HERE
Blah blah blah
HERE
Either <<< or >>>
But you don't really need that...
Just use \ in front of the kind of quotes you are using on the outside part:
$foo = 'You need to use \\ in front of any \'apostrophes\' but not "quotes"
inside here';
$bar = "You need to use \\ in front of any \"quotes\" but not 'apostrophes'
inside here";
--
Like Music? http://l-i-e.com/artists.htm