Re: heredoc syntax
| From: | Matthew Weier O'Phinney | Date: | Wed, 20 Oct 2004 19:38:31 +0000 |
| Subject: | Re: heredoc syntax | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199935@lists.php.net to get a copy of this message | ||
* Janet Valade <jvalade@eoni.com>:
> Adil wrote:
>
>> anyone know why heredoc syntax might not work with php5/apache installed. I
>> can't get even the simplest strings in heredoc syntax to work and I've tried
>> just cutting and pasting other peoples stuff in that syntax as well, and
>> still no luck
>
> Heredoc syntax is pretty rigid and it's easy to have it wrong invisibly.
^^^^^^^^^
That's the key -- whitespace is invisible to the naked eye typically.
> $varname = <<<END
> Text of string
> END;
>
> The first END must be at the end of the line, nothing after it, not even
> a blank space. The last END must be at the beginning of the line, not
> before it, not even a blank space.
And don't forget that the last END must be followed by a semi-colon
ONLY, no other characters on that line... ;-)
--
Matthew Weier O'Phinney | mailto:matthew@garden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org