function CountNumberOfEachVowelInString($s) {
$vowels = "aeiou";
$countVowels = array();
foreach (str_split($vowels) as $ch) {
$countVowels[$ch] = 0;
}
return $countVowels;
}
$s = "python c c++ c# java php javascript";
$countVowels = CountNumberOfEachVowelInString($s);
foreach (str_split($s) as $ch) {
if (array_key_exists($ch, $countVowels)) {
$countVowels[$ch]++;
}
}
print_r($countVowels);
/*
run:
Array
(
[a] => 4
[e] => 0
[i] => 1
[o] => 1
[u] => 0
)
*/