Re: Ternary operators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Carl Furst" <carl@xxxxxxxx> wrote in message 
news:35.00.01095.36093F34@xxxxxxxxxxxxxxx
> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux