If I define a simple string variable, how would I count and output the number of vowels in the string in the simplest possible way?
I have searched and found a number of similar ways to do so, but most seem more complex than necessary. They are all functional and maybe the complexity IS necessary, but I am looking for the simplest solution possible.
My string variable would be something like:
$someString = "This is some text with some more text and even more text."
Here's an easy solution:
<?php $string = "This is some text with some more text and even more text."; echo "There are <strong>".preg_match_all('/[aeiou]/i',$string,$matches)." vowels</strong> in the string <strong>".$string."</strong>"; ?>