I am trying to find the Mode Average within an array of numbers, which works fine when the array only contains positive values. However, it seems to ignore any negative values in the array and I can't work out why?
$test_array = array(3.32,4,-5.51,2,4.44,1,2,3,5,-5.51,-5.51);
$v = array_count_values($test_array);
arsort($v);
foreach($v as $k => $v){$mode_avg = $k; break;}
echo $mode_avg;
This outputs "2", when it should output "-5.51" ?