DEV Community

Discussion on: Daily Challenge #3 - Vowel Counter

Collapse
 
celyes profile image
Ilyes Chouia

Here's my solution:
PHP:


function countVowels($string){
    preg_match_all("/[aeiou]/i", $string, $matches);
    return sizeof($matches[0]);
}
echo "Number of vowels : " . countVowels("sUpercalifragilisticexpialidocious");