Re: // ?>

From: Date: Wed, 05 Dec 2007 01:49:10 +0000
Subject: Re: // ?>
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-265461@lists.php.net to get a copy of this message
On Dec 4, 2007 8:41 PM, Kevin Schmeichel <schmeic-php@lovo.org> wrote: > Here's some unexpected behavior: > > <?php > // ?> what? > ?> > > This will output "what?" - I expected no output, as is the case if the > inline comment was a /* */ comment. Is this a bug? > > Kevin > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > No, that is expected behavior. Try this: <? // blah, blah, blah ?> This will display .... versus this: <? /* blah, blah, blah ?> This will be hidden */ ?> Comments with //double-slashes and #hashmarks terminate when the code container terminates, because the ending ?> indicates that it's time for the parser to stop interpreting code. However, /*slash-starred comments do not terminate, as the parser expects a closing comment tag*/. For all intents and purposes, you could consider the /* as a sleeping pill, and the */ as the alarm clock. ANYTHING that happens between those will have no attention paid to it by PHP. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you.

« previous php.general (#265461) next »