RE: [PHP] comment followed by ?> fails to parse

From: Date: Wed, 29 May 2002 12:05:52 +0000
Subject: RE: [PHP] comment followed by ?> fails to parse
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-99685@lists.php.net to get a copy of this message
[snip] ...lots of stuff from lots of messages... [/snip] If you need to display PHP code in an HTML page and have it validate properly you need to use the following; &lt;? php ?&gt; which will properly display as <? php ?> As a matter of course it is typical to use &lt; (<) and &gt; (>) along with a set of pre-formatted tags (<pre></pre>) when using HTML to display code. Many online magazines have adopted this syntax for code display. Therefore; <pre> &lt;? php //lots of code here if(foo == bar){ do some stuff; } else { do other stuff; } //now do some HTML print("&lt;title&gt;" . $title_variable . "&lt;/title&gt;") ?&gt; </pre> will display the code block and its comments properly in an HTML page. HTH! Jay

« previous php.general (#99685) next »