hi there...
super simple question for most of you out there,
i am having a php string define by ' (ex. 'this is my string') and i want to have the ' characted into the string. (ex. 'this is 'my' string' )
how can i do that? something about the / character or that works only at javascript?
thanks
apostrophe into string
Moderator: General Moderators
Code: Select all
$s = "this is 'my' string";
$s = 'this is \'my\' string';
$s = <<< eot
this is 'my' string
eot;In my opinion the EOT method is probably best but does complicate things alot if you dont know how to use it.
http://www.php.net/heredoc
That explains it, using that you don't need to escape any " double quotes or single quotes etc.
http://www.php.net/heredoc
That explains it, using that you don't need to escape any " double quotes or single quotes etc.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA