Dumb question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kippy
Forum Commoner
Posts: 84
Joined: Wed Jun 07, 2006 8:25 pm

Dumb question

Post 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.
User avatar
andyhoneycutt
Forum Contributor
Posts: 468
Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls

Re: Dumb question

Post 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
kippy
Forum Commoner
Posts: 84
Joined: Wed Jun 07, 2006 8:25 pm

Re: Dumb question

Post by kippy »

Awesome, thanks...!
kippy
Forum Commoner
Posts: 84
Joined: Wed Jun 07, 2006 8:25 pm

Re: Dumb question

Post 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.
User avatar
andyhoneycutt
Forum Contributor
Posts: 468
Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls

Re: Dumb question

Post by andyhoneycutt »

You should probably post this question in a new topic to help keep the forums organized.

Thanks,
Andy.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Dumb question

Post 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\"";
Post Reply