function findKey($array, $keySearch) {
global $count;
foreach ($array as $key => $item) {
if (stripos($key, $keySearch) !== false){
$count++;
echo "<li>".$key."</li>";
}
if (is_array($item)){
findKey($item, $keySearch);
}
}
}
$count = 0;
findKey($array, $keySearch);
echo "Total number of keys: ".$count;
7
solved How can I count the keys inside a for each loop?