php array count by key code example
Example 1: php length of array
<?php
$arr = ["one", "two", "three", "four"];
echo count($arr);
?>
Example 2: php count array elements with specific key
$cnt = count(array_filter($array,function($element) {
return $element['your_key']=='foo';
}));