Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2000071

Re: [PHP] "here" document From: Hans H. Anderson (me <email protected>)
Date: 07/14/00

> 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 <email protected>
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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>