We're a place where coders share, stay up-to-date and grow their careers.
Here is my simple solution with PHP:
function getCount($str) { $vowelsCount = 0; $vowels = ['a', 'e', 'i', 'o', 'u']; $index = 0; for(; $index < mb_strlen($str); $index++) { if (in_array($str[$index], $vowels)) { $vowelsCount += 1; } } return $vowelsCount; }
Here is my simple solution with PHP: