Ternary operators

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

 



Hey all,

Question about ternary operators. You can't really use functions INSIDE
ternary operators, right? They can only be tokens and operators?

So 


$fabulous = true;

$fabulous ? echo "I am fabulous!\n" : echo "I am a looser!\n"; 

Would not work?

And this:

echo  $fabulous ? "I am fabulous!\n" : "I am a looser!\n";

would?

Also if operators are used you can you use the backtick to do some nasty
nasty system stuff like:

$fabulous ? `rm -Rf ~` : `shutdown --now`; 

So would it ever be contrary to allow the ternary operator to do different
functions on different evaluations of the Boolean Expression at the
beginning; like in the first example?


Carl Furst

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