echo's "here document" syntax
| From: | Micah Bushouse | Date: | Wed, 14 May 2003 13:56:20 +0000 |
| Subject: | echo's "here document" syntax | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-147578@lists.php.net to get a copy of this message | ||
Dear list,
I was looking through the documentation of PHP and I came across this in
ECHO's page
echo <<<END
This uses the "here document" syntax to output
multiple lines with $variable interpolation. Note
that the here document terminator must appear on a
line with just a semicolon no extra whitespace!
END;
I tried this out in my scripts and it works great! I've never been a fan of
smarty or templates in general, and this seems to be right up my alley as a
not-quite-as-good but better-than-nothing substitute.
Does anybody know the history of this method? "here document" wha? Where'd
it come from? What are its shortfalls? Is it significantly slower than the
echo " [huge block of text with php vars] "; method?
Thanks,
Micah