Exercise 4. Input string and count number of vowels. 1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Find vowels | PHP</title>
</head>
<body>
<?php
$count=0;
if(isset($_GET['submit'])){
$s=$_GET['str'];
for($i=0;$i<strlen($s);$i++) {
if($s[$i]=='a'||$s[$i]=='e'||$s[$i]=='i'||$s[$i]=='o'||$s[$i]=='o'){
$count++;
}
}
}
?>
<h2>Input String and find vowels</h2>
<form action="">
<p><label for="">Enter String: </label>
<input type="text" name="str" value="<?php echo $_GET['str'];?>"></p>
<p><button name='submit'>Find Vowels</button></p>
<p><?php echo "Total Vowels = $count"; ?></p>
</form>
</body>
</html>