Jump to content

[SOLVED] Define a heredoc variable end?


53329

Recommended Posts

It's been bothering me.  I know that anything that is now a valid character for a variable will end it but is there another way to do it?  I hate having to keep defining extra variables to account for it.

 

One example of this...

$url="index.php?";//predefined a long time ago
$newurl=$url."page=this";
echo <<<PAGE
<a href="$newurl">My page</a>
PAGE;

 

or creating words

 

$type="sand";//predefined a long time ago
$newtype=$type."paper";
echo <<<PAGE
<html>
$newtype
</html>
PAGE;

 

It gets to be a pain after a while.

Link to comment
https://forums.phpfreaks.com/topic/123377-solved-define-a-heredoc-variable-end/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.