note 10192 deleted from function.echo by jeroen
| From: | jeroen@php.net | Date: | Sat, 08 Sep 2001 22:31:02 +0000 |
| Subject: | note 10192 deleted from function.echo by jeroen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17821@lists.php.net to get a copy of this message | ||
Echo and here-doc can be very handy, but you need to know two important things on top of from
syntax.
Follow this basic syntax...
echo <<<EOT
My name is $name.
My second child's name is {$children[2]['name']}.
EOT;
Two important things to note:
(1) Whitespace after "echo <<<EOT" can lead to an error like this:
...expecting
','' or ';''...
So it's important to start a new line DIRECTLY after the first EOT.
(2) Placing the terminating EOT on any column other than the very first of a line can yield errors
reported on lines that are really fine... the error may look like this:
...parse error, expecting T_STRING' or T_VARIABLE' or...
So it's also important to put EOT at the very beginning of a line.
Take a look at http://www.php.net/manual/html/language.types.string.html#AEN2504
for more information.