📜  php 计算具有特定键的数组元素 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:31.257000             🧑  作者: Mango

代码示例2
$tmp = array_count_values($uid);
$cnt = $tmp[12];
//Or
$cnt = count(array_filter($uid,function($a) {return $a==12;}));
//In both cases $var will be a number