Here is a PHP program to count the number of vowels in a string "welcome".
<html> <body> <?php $count=0; $a="wellcome"; for($i=0;$i<strlen($a);$i=$i+1) { if($a{$i}=='a'||$a{$i}=='e'||$a{$i}=='i'||$a{$i}=='o'||$a{$i}=='u') //here $a{i} will return the character for ith position { $count=$count+1; } } echo "The number of vowels are:-".$count; ?> </body> </html>
Output: The number of vowels are:- 3