There are three way to find max value in array

Using max function

<?php
$array = array(44,16,81,12);
echo(max($array));
?>

OUTPUT: 81

Using foreach loop

<?php
$array = array(44,16,81,12);

$b = 0;
foreach($array as $key => $value) {
	if($value > $b) {
		$b = $value;
	}
}
echo $b;
?>

OUTPUT: 81

Using for loop

<?php
$array = array(44,16,81,12);

$b = 0;
for($i=0;$i<count($array); $i++) {
	if($array[$i] > $b) {
		$b = $array[$i];
	}
}
echo $b;
?>

OUTPUT: 81