http://qs321.pair.com?node_id=1138112


in reply to Re: Ternary vs. Sort vs. Max
in thread Ternary vs. Sort vs. Max

if ($x < $y ) { $max = $y; } else { $max = $x; }

When faced with the need to write a similar construct (e.g., the condition is too long to make an easily scannable ternary or the like), I find it easier to Just Pick One and then write one conditional, like

$max = $x; if($x < $y) { $max = $y; }

Aside from shorter, I find it actually more descriptive, especially if the other side is an else rather than elseif; "x except when y" as a description reads just like the code.