Page 1 of 1

Biggest int from array

Posted: Wed Dec 15, 2004 2:59 pm
by ol4pr0
I have been messing around to see how to get the largest value of an array. untill now i have not come with a solution.

Code: Select all

array("1","2","3");
$biggest = ?

Posted: Wed Dec 15, 2004 3:35 pm
by rehfeld
sort()

Posted: Wed Dec 15, 2004 3:46 pm
by ol4pr0
Found it .. :), altho i am up for better solutions

Code: Select all

$x = 6;
$y = max("5","6","7");
if ($y < $x) { 
	echo $x." is bigger"; 
	}
	else
	{
	echo $y ." is bigger"; 
}