I am trying to get highest number from array. But not getting it. I have to get highest number from the array using for loop.
<?php
$a =array(1, 44, 5, 6, 68, 9);
$res=$a[0];
for($i=0; $i<=count($a); $i++){
if($res>$a[$i]){
$res=$a[$i];
}
}
?>
I have to use for loop as i explained above. Wat is wrong with it?
$res = max($a);not working for you?