What we will do if we have to count the vowels in a string. Don’t worry i’m going to write the code of it that counts the vowels.
Code Example:
<?php ini_set('display_errors', 0); error_reporting(E_ERROR | E_WARNING | E_PARSE); ?> <h1><center> <form action="#" method="POST"> <textarea name="text2" cols=25 rows=10><?php echo $_POST['text2']; ?></textarea><br> <input type="submit" /><br /><br /><br /><br /> <?php $s = " "; $a = $_POST['text2']; $b = 0; while ( isset($a[$b]) ) { if(ord($a[$b])==65 || ord($a[$b])==69 || ord($a[$b])==73 || ord($a[$b]) == 79 || ord($a[$b])==85 || ord($a[$b]) == 97 || ord($a[$b])== 101 || ord($a[$b]) == 105 || ord($a[$b]) == 111 || ord($a[$b]) == 117) { $vowels = $vowels + 1; } else { $consonents = $consonents + 1; } $b++; } echo "Total No Of Vowels : ".$vowels; echo "<br>"; ?> </center> </h1>