Re: heredoc problem
| From: | Ernest E Vogelsinger | Date: | Sun, 02 Mar 2003 23:09:49 +0000 |
| Subject: | Re: heredoc problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137810@lists.php.net to get a copy of this message | ||
At 23:02 02.03.2003, janet@valade.com said:
--------------------[snip]--------------------
>Can someone tell me what is wrong with the following code:
>
><?php $str = <<
>This is code straight out of the PHP manual. I get the error:
>Parse error: parse error, unexpected T_SL in testhere.php on line 5
>
>I looked up T_SL and it is a token representing << so that means it just
>doesn't get the <<<. Why not? I've tried all the combinations of spaces and
>no space in that line that I can think of.
--------------------[snip]--------------------
The correct heredoc syntax:
$text = <<<EOT
This is
all
a heredoc
text
EOT;
Note: the heredoc delimiter
1) must not be indented
2) must be all lone on a single line (except an optional terminating semicolon)
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/