Here Doc syntax
| From: | Soma Interesting | Date: | Tue, 20 Feb 2001 01:48:42 +0000 |
| Subject: | Here Doc syntax | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-40684@lists.php.net to get a copy of this message | ||
I'm having a real love/hate relationship with PHP's here-doc support.
I love that it spares me from breaking in and out of PHP mode or using echo and back slashes for outputting largish bodies of dynamic HTML....
but I hate a) that the EOT; has to be the first thing on the line and b) I find that here-doc seems to make scripts unparsable on many occasions and I can never find the bug. I'd say 1/5 times I wind up breaking the script just sticking an:
echo <<<EOT
<table width="450" border="0" cellspacing="0" cellpadding="2" bordercolor="#000000">
<tr>
<td bgcolor=orange>
<font color=red>{$error}</font><P>
</td>
</tr>
</table>
EOT;
into a page some place. Any suggestions from anyone?
Appreciated.