Reply to Re: shortif (tertiary) fails with echo but not print ?

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация