You are here: Re: [PHP] if then else short form « PHP « IT news, forums, messages
Re: [PHP] if then else short form

Posted by Jochem Maas on 01/21/05 14:14

Ben Edwards wrote:
> I seem to remember seing someone use a abreaviated form of a
> if/them/else of the type that can be used in java.
>
> It was something like
>
> if ( a=b ) ? a=1 ; a=2;

$a = ($a == $b) ? 1: 2;

which meand: if $a is equal to $b then set $a to 1 otherwise set $a to
2. that is equivalent to:

if ($a == $b) {
$a = 1;
} else {
$a = 1;
}

btw: its called the 'tertiary' syntax (because its the third form)

>
> Anybody know what the correct syntax is?
>
> Ben

 

Navigation:

[Reply to this 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

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