Re: "here" document
| From: | Hans H. Anderson | Date: | Fri, 14 Jul 2000 20:22:50 +0000 |
| Subject: | Re: "here" document | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6703@lists.php.net to get a copy of this message | ||
> The difference is that the "here document" function in Perl is used to embed
> HTML in the Perl file. PHP is the other way around. It's not HTML embedded
> in a Php file, it's Php embedded in an HTML file. Personally, I like it
> better this way. With this ability, I can't see any need for perls "here
> document" function. This was is easier.
In addition to the mentioned
print <<<HERE
My name is <a href="$site">$name</a>
HERE
as opposed to
My name is <a href="<?php print $site; ?>"><?php print $name;
?></a>
It would be good for writing files. Sometimes I need to output HTML
files, and there is a lot of escaping of double-quotes. This sort of
syntax would eliminate that necessity, too.
This is time-consuming:
$file = "
My name is <a href=\"$site\">$name</a>
";
My fingers no like \"!
Hans Anderson ~ me@hansanderson.com
PO Box 426, Missoula, MT 59806 | PHP, Search Engines, SQL
(800)397-9116 / (406)549-6524 | Databases, Flash Multimedia,
http://www.hansanderson.com | Killer Audio Production,
http://www.goofiness.com | Minty Fresh Breath.