Re: if then else short form
| From: | Jochem Maas | Date: | Fri, 21 Jan 2005 12:14:53 +0000 |
| Subject: | Re: if then else short form | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-206925@lists.php.net to get a copy of this message | ||
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