Re: Ternary operators
| From: | Dan Baker | Date: | Wed, 15 Feb 2006 20:58:25 +0000 |
| Subject: | Re: Ternary operators | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230469@lists.php.net to get a copy of this message | ||
"Carl Furst" <carl@vote.com> wrote in message
news:35.00.01095.36093F34@pb1.pair.com...
> Hey all,
>
> Question about ternary operators. You can't really use functions INSIDE
> ternary operators, right? They can only be tokens and operators?
You *can* use functions inside of ternary operators, as long as they return
a value. The ternary operator acts like a r-value, like a "number".
$fabulous = 1;
$fabulous = FunctionCall(x,y,z)? 1 : 2;
$fabulous = $checkValue? FunctionCall1(x) : FunctionCall2(y);
DanB