Friday, 13 April 2018

WT-Slip20


20)Design a HTML form to accept a String. Write a PHP function to count the total number of
vowels (a,e,i,o,u) from the string. Show the occurrences of each vowel from the string 

<html>
<body>
<form action=""method="post">
<input type="text"name="string"/><input type="submit"value="submit"/>
</form></body></html>

<?php
if($_POST)
{
$string=strtolower($_POST['string']);
$num=preg_match_all('/[aeiou]/i',$string,$matches);
echo "Number of Vowels:".$num;
}
?>