RE: [PHP] here document
| From: | Bjorn Sodergren | Date: | Thu, 02 Nov 2000 15:57:33 +0000 |
| Subject: | RE: [PHP] here document | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-23416@lists.php.net to get a copy of this message | ||
if you look at the docs,
<?
//stuff
echo <<<EOT
My name is "$name". I am printing some $foo->foo.
Now, I am printing some {$foo->bar[1]}.
This should print a capital 'A': \x41
EOT;
?>
is perfectly valid,
without it would be as...
<?
//stuff
echo "My name is \"$name\". I am printing some $foo->foo.";
echo "Now, I am printing some {$foo->bar[1]}.";
echo "This should print a capital 'A': \x41";
?>
or
<?
//stuff
?>
echo "My name is "<?=$name?>". I am printing some <? echo
$foo->foo?>.";
echo "Now, I am printing some <? echo {$foo->bar[1]}?>.";
echo "This should print a capital 'A': \x41";
<?
//end
?>
The here document looks pretty handle and much simpler than not using it.
-----Original Message-----
From: Dean Hall [mailto:hall@apt7.com]
Sent: Wednesday, November 01, 2000 11:22 PM
To: Jack Dempsey; php-general@lists.php.net
Subject: Re: [PHP] here document
> anything like perl's
> print<<EOF
> blah blah blah
> EOF
>
> ?
There's no need for here documentation in PHP. PHP is embedded in HTML, not
the other way around. To do something like that, you'd do:
<?
// some PHP
?>
blah blah blah
<?
some more PHP
?>
Dean.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net