In PHP when using ternary operator (?:) what are benefits/damage of evaluating multiple conditions at a time? -
having hard time finding words phrase every example using ternary uses single condition
$x = ($x > 1) ? 1 : 0; $x = (any single evaluation) ? if true : if false; above, how example found structured.
my question though structure below, using here &&
$x = (($x > 1) && ($z === 0)) ? 1 : 0; so question whether using format of last example above frowned upon or causes issues since have never seen used or benefits/damage explained.
the possible issue more complex condition, harder read. there comes point it's easier read if( ... ) {$x = 1;} else {$x = 0;} ternary operator alternative.
Comments
Post a Comment