2
20/10/2024 8:09 am
Konu başlatıcı
Write a function that receives a single string and prints the count of the vowels. Use appropriate name for the function.
Examples:

1 Yanıt
2
20/10/2024 8:10 am
Here is my answer:
<?php
$word = readline();
echo countVowels($word);
function countVowels($input) {
$count = 0;
for ($i = 0; $i < strlen($input); $i++) {
$current = strtolower($input[$i]);
if ($current == "a" || $current == "u" || $current == "i" || $current == "e" || $current == "o") {
$count++;
}
}
return $count;
}
