array_count_values:返回数组中所有值出现的次数
程序员文章站
2022-04-30 17:38:24
...
跳至
$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 )