Posted by Rami Elomaa on 05/01/07 16:05
Tyno Gendo kirjoitti:
> I have just written a line of code like this (yes, many people think
> this stinks bad):
>
> <?php true == isset($page_seq) ? echo "$page_seq" : false; ?>
>
> However it breaks with 'Unexpected T_ECHO'
>
> But
>
> <?php true == isset($page_seq) ? print "$page_seq" : false; ?>
>
> Works as expected.
>
> Anyone know why? Maybe its blindly obvious to someone, that time of
> the day when the brain SLLLOOOOOOOWWS down.
It's mentioned vaguely in the manual:
"echo() is not actually a function (it is a language construct), so you
are not required to use parentheses with it. echo() (unlike some other
language constructs) does not behave like a function, so it cannot
always be used in the context of a function."
http://fi.php.net/manual/en/function.echo.php
Also read this:
http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40
--
Rami.Elomaa@gmail.com
"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
[Back to original message]
|