[thelist] [PHP] Heredoc and Constants

Mike F lists at wirelust.com
Thu Aug 14 14:05:21 CDT 2003

There isn't any way to do that...

Straight off the PHP site (http://us3.php.net/constants):

"Warning, constants used within the heredoc syntax 
(http://www.php.net/manual/en/language.types.string.php) are not 

Editor's Note: This is true. PHP has no way of recognizing the constant 
from any other string of characters within the heredoc block."

Keith Dahlby wrote:

> Greetings,
> I'm working on a theme for PHP-Nuke and would like to use Heredoc syntax 
> [1] for big blocks of HTML (I'm sick of reading code with endless \" and 
> \n). The only problem is that Nuke stores language information as 
> constants. All the themes I've seen simply break out of the string to 
> include this information: "<p>"._CONSTANT."</p>", but this is extremely 
> inconvenient with Heredoc. I know constants can be referenced with the 
> constant('_CONSTANT') function, but there doesn't seem to be a way to 
> embed a function call, either.
> Ideas? TIA!
> Cheers ~ K
> [1] http://www.php.net/types.string#language.types.string.syntax.heredoc

More information about the thelist mailing list