I\'m trying to get hold of the largest value in an array, while still preserving the item labels. I know I can do this by running sort(), but if I do so I simply lose the la
$a = array(10, 20, 52, 105, 56, 89, 96); $b = 0; foreach ($a as $key=>$val) { if ($val > $b) { $b = $val; } } echo $b;