Ternary operators
| From: | Carl Furst | Date: | Wed, 15 Feb 2006 20:34:37 +0000 |
| Subject: | Ternary operators | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-230463@lists.php.net to get a copy of this message | ||
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