[UPHPU] short syntax without the else?
Dave Smith
dave at thesmithfam.org
Sat Jan 19 23:28:45 MST 2008
Brady Mitchell wrote:
> Keep in mind that this is a bit more difficult read than the standard:
>
> if($condition == false && $var == "foo")
> {
> echo false
> }
> else
> {
> echo "foo";
> }
That's not what my code does at all. You might want to read over it
again. Maybe that just reinforces your point about readability. :)
The code,
$condition && $var = "foo";
simply assigns "foo" to $var if $condition evaluates to true.
It's exactly what Wade wanted, namely, using the '?' without the ':'
--Dave
More information about the UPHPU
mailing list