Page 1 of 1

Dumb question

Posted: Wed Sep 03, 2008 11:46 am
by kippy
How can I include ""'s inside an echo command? Is there limit to the number of "" that can be used inside an echo command? Thanks.

Re: Dumb question

Posted: Wed Sep 03, 2008 11:53 am
by andyhoneycutt
Escape characters in double-quoted text to print them as literals. For instance:

Code: Select all

$text = "Jane said, \"Hi! How are you?\"";
Gives, literally: Jane said, "Hi! How are you?"
Beware that text in single-quotes is treated as literal and non-interpreted. For example:

Code: Select all

$text = 'Jane said, $what_jane_said\n';
Will output as: Jane said, $what_jane_said\n. Rather than the possible desired: Jane said, Hi! how are you?<new line>.

-Andy

Re: Dumb question

Posted: Wed Sep 03, 2008 12:03 pm
by kippy
Awesome, thanks...!

Re: Dumb question

Posted: Wed Sep 03, 2008 12:15 pm
by kippy
If I am trying to send html through mail(), how do I get the message to show up correctly without displaying all of the html code? Thanks.

Re: Dumb question

Posted: Wed Sep 03, 2008 12:48 pm
by andyhoneycutt
You should probably post this question in a new topic to help keep the forums organized.

Thanks,
Andy.

Re: Dumb question

Posted: Wed Sep 03, 2008 12:55 pm
by jaoudestudios
Can you show an example?

You will need to escape any inner quotes but no there is no limit!

eg. echo "He said \"Jump jump\"";