Re: // ?>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Dec 4, 2007 8:41 PM, Kevin Schmeichel <schmeic-php@xxxxxxxx> 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux