Write a PHP program to count number of vowels in a given string.
Note: Use a regular expression to count the number of vowels (A, E, I, O, U) in a string.
<?php //Licence: https://bit.ly/2CFA5XY function count_Vowels($string) { preg_match_all('/[aeiou]/i', $string, $matches); return count($matches[0]); } print_r(count_Vowels('sampleInput')); ?>
Sample Output:
4
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer