Re: print <<<EOF
| From: | Lars Torben Wilson | Date: | Tue, 07 Nov 2000 21:05:27 +0000 |
| Subject: | Re: print <<<EOF | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24192@lists.php.net to get a copy of this message | ||
Boget, Chris writes:
> Why isn't this working?
>
> <script language="php">
>
> print <<<EOF
>
> hello,
> my name is
> chris
>
> EOF;
>
> </script>
>
> I get a parse error on line 3 (which is this line:
>
> print <<<EOF
>
> It looks right... Any ideas?
>
> Chris
The last EOF; needs to begin in the first column of the line:
<script language="php">
print <<<EOF
hello,
my name is
chris
EOF;
</script>
This should work. Also, you need to make sure that there is no
whitespace *at all* before the EOF on the first line, or after (!) the
semicolon on the last EOT line. It's the only place in PHP where this
sort of restriction is enforced.
I have been told only that 'it is by design'. No explanation was
offered. I'm sure someone can explain why it's good not to allow
whitespace after the semicolon.
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Netmill iTech|
|http://www.coastnet.com/~torben http://www.netmill.fi|
|Ph: 1 250 383-9735 torben@netmill.fi|
+----------------------------------------------------------------+