Displaying Portions of Raw HTML Code Page 6

Another new feature to PHP4 is a new syntax is modeled after Perl's "here printing." It is possible to display complete portions of HTML code by flanking them with either a print or echo instruction and an end label. Unlike Perl, the operator used is not a double less than sign (<<), but a triple less than sign (<<<) so as to distinguish it from the binary shift operator. For example:


$version = phpversion();
$valstr = "Example of HerePrinting\n";

echo "<hr><br>/n";

print <<< mylabel

<h4>PHP's New Features</h4>
<li>ISAPI support
<li>COM support on Win32
<li>Java and servlets support

<p>$valstr <br>Tested on PHP version $version</p>


echo "<hr><br>/n";

This article was originally published on Sep 7, 2000

Thanks for your registration, follow us on our social networks to keep up-to-date