Jump to content

Recommended Posts

I've got a little bit of code where I fill a variable with <<< . (I'm such a newbie, I don't even know what that's called!) Like this:

[code]$body=<<<_MSG_

This is the body of a message.

_MSG_;[/code]

What I'd like to do is insert some MySQL variable information into the middle of that. I tried the following, but got a parsing error. Is there a way around this?

[code]$body=<<<_MSG_

This is the body of a message sent to $row_rsVerify['email']

_MSG_;[/code]

Thanks!
Link to comment
https://forums.phpfreaks.com/topic/5443-using-variables-with/
Share on other sites

No, that won't work. The OP is using the heredoc format. (why it's called that is lost in the antiquities of the C language... :-) ) The '<<<' is not part of the string and neither is the "_MSG_".

The solution here is to use curly brackets around the array variable.
[code]<?php
$body=<<<_MSG_

This is the body of a message sent to {$row_rsVerify['email']}

_MSG_;
?>[/code]

Ken
Link to comment
https://forums.phpfreaks.com/topic/5443-using-variables-with/#findComment-19471
Share on other sites

[!--quoteo(post=357102:date=Mar 21 2006, 05:30 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Mar 21 2006, 05:30 PM) [snapback]357102[/snapback][/div][div class=\'quotemain\'][!--quotec--]
No, that won't work. The OP is using the heredoc format. (why it's called that is lost in the antiquities of the C language... :-) ) The '<<<' is not part of the string and neither is the "_MSG_".

The solution here is to use curly brackets around the array variable.
[/quote]
[b]heredoc format[/b]? Man, I never would've guess that! Or the curly braces!

But that's just what I needed.

When you don't know the name for something, it makes it mighty hard to search for help with it.

Thanks a heap!

P.S. How is "heredoc" pronounced? Is it like "heretic" or "hear-dock"?!
Link to comment
https://forums.phpfreaks.com/topic/5443-using-variables-with/#findComment-19631
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.