📅  最后修改于: 2022-03-11 14:53:36.936000             🧑  作者: Mango
function median($a) {
sort($a);
$c = count($a);
$m = floor(($c-1)/2);
return ($c % 2) ? $a[$m] : (($a[$m]+$a[$m+1])/2);
}
echo median([1,6,4,2,4,6,10,12,19]); //6