跳至$arr1 = ['a','b','c','d','e','e','a','a']; $arr = array_count_values($arr1); echo ''; print_r($arr); result: Array ( [a] => 3 [b] => 1 [c] => 1 [d] => 1 [e] => 2 )