Professional Documents
Culture Documents
Pract 12
Pract 12
<!doctype html>
<html><head><title>Vowels in string</title></head>
<body>
<h2>Number of vowels in string</h2>
<form method="post">
<input type="text" name="string">
<input type="submit">
</form></body></html>
<?php
if($_POST)
{
$string=strtolower($_POST['string']);
$vowels=array('a','e','i','o','u');
$len=strlen($string);
$num=0;
for($i=0;$i<$len;$i++)
{
if(in_array($string[$i],$vowels))
{
$num++;
}
}
echo"Length of string is".$len;
echo"<br>Number of vowels in string :- ".$num;
}
?>