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]
|