$nialiakhirpraktikum = $ntugasakhir+$ratarata; //from other process
if ($nialiakhirpraktikum>79) { $grade="A"; }
else if ($nialiakhirpraktikum<=79 AND $nialiakhirpraktikum>67) { $grade="B"; }
else if ($nialiakhirpraktikum<=67 AND $nialiakhirpraktikum>55) { $grade="C"; }
else if ($nialiakhirpraktikum<=55 AND $nialiakhirpraktikum>44) { $grade="D"; }
else { $grade="E"; }
$array = array($grade);
print_r(array_count_values($array));
我在这样的数组中有一些结果:
Array ( [B] => 1 )
Array ( [B] => 1 )
Array ( [C] => 1 )
Array ( [C] => 1 )
Array ( [B] => 1 )
Array ( [B] => 1 )
Array ( [B] => 1 )
Array ( [B] => 1 )
Array ( [B] => 1 )
Array ( [B] => 1 )
如何得到如下结果:
score for B = 8
score for C = 2