views:

165

answers:

3

Is there a built in PHP function that will allow you get the minimum and maximum values from a PHP array?

If not, what's the most efficient way of doing this for the general case?

+2  A: 

Max Min

alexn
+2  A: 

Yes there is. min() and max()

Vertigo
+9  A: 

min and max.

$array = array(1, 2, 3);

$min = min($array);
$max = max($array);
Alex Barrett
+1 for kitten icon, I guess?
Adam Backstrom