$nums = array(1,3,4,2,3,6,7,8,9,8,33); $max_value = -99999; foreach ($nums as &$value) { if ($value > $max_value) $max_value = $value; } echo $max_value;