Marcel said the following on 02/06/2005 10:21:
The ternary operator is not designed to execute code. It's designed for
uses such as:
$a = $flag : "yes" : "no";
i.e. assigning a value dependent on the logical state of $flag. It just
so happens that your code above works, because '$a = "yes"' evaluates to
a value, and so can be used in the ternary operator.
Why not just use if? That's what it's there for! And it's far more
obvious what's going on than trying to cram a load of code onto one line.