php count array elements with specific key
snippet in php

php count array elements with specific key

user9522

$cnt = count(array_filter($array,function($element) {
  return $element['your_key']=='foo';
}));

php count amount of times a value appears in array

user3905

$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