How to find max value ,return the only one number with the highest value
Here is my code:
<?php
foreach($graphData as $gt) {
echo $gt['pView'].',';
}
?>
Result:
0,0,0,18,61,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
im try something like this
<?php
$str = '';
foreach ($graphData as $gt){
$str = array($gt['pView'],);}
$max =max($str);
if($max == 0){echo '20';}
else
{echo $max +20;}
?>
and result is always 20, but shold be 106 + 20
Whats wrong in my code ?