Tim Musson wrote:
> Hey all,
>
> I need to return the largest of 3 vars. Is there a better way than
> nested IF statements? Maybe put them in an array and sort it?
You can write the sort without needing a separate array:
$max = (sort {$b<=>$a} ($x, $y, $z))[0];
Or, you can do something like this
$max = ($max = ($x > $y) ? $x : $y) > $z ? $max : $z;
(I'm sure somebody can simplify that)
If you get more than 3 vars, the sort is probably the cleanest way to write
it.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]