|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-01-29 19:52 UTC] moptop69 at ntlworld dot com
when using define() to create constants, it all seems to work fine when using standard strings. However, under the definition for the arguments on define(), it says that the define function can take string() as an argument. looking at strings, heredoc is a valid string argument, however when trying to define a constant as follows, the constant returns a null string. define($html_header, <<<THISISSTRING the string goes here THISISSTRING ); if however you define a standard var like so: $str_header=<<<THISISSTRING the string goes here THISISSTRING ; then do: define($html_header $str_header); all works fine. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Jan 13 21:00:02 2026 UTC |
There's nothing wrong/broken in it: <?php define('foo', <<<THISISSTRING the string goes here THISISSTRING ); echo foo; ?> outputs 'the string goes here' so it works fine. You're just doing something wrong, most likely you have some empty space before the heredoc end tag.. Not bug.