in reply to Re^2: Better expression for $x = !!$y||0
in thread Better expression for $x = !!$y||0
Since you don't like seeing the conditional operator in the if, why don't you move it to the outside?
$x = $y ? 1 : 0; if ($x) { ... }
It has the added advantage of removing an assignement from an if's condition, something I find quite unnatural and unreadable.
|
|---|