fork download
  1. <html>
  2. <body>
  3. <form method="GET" action="First.php">
  4. Enter the String : <input type="text" name="inputStr"><br>
  5. <input type="submit" name="Submit">
  6. </form>
  7. </body>
  8. </html>
  9.  
  10. First.php
  11.  
  12. <?php
  13.  
  14. $string = $_GET['inputStr'];
  15.  
  16. $vowels = array("a"=>0,"e"=>0,"i"=>0,"o"=>0,"u"=>0);
  17.  
  18. for($i=0; $i<strlen($string); $i++) {
  19. if(strtolower($string[$i]) == 'a') {
  20. ++$cnt;
  21. ++$vowels['a'];
  22. }
  23. if(strtolower($string[$i]) == 'e') {
  24. ++$cnt;
  25. ++$vowels['e'];
  26. }
  27. if(strtolower($string[$i]) == 'i') {
  28. ++$cnt;
  29. ++$vowels['i'];
  30. }
  31. if(strtolower($string[$i]) == 'o') {
  32. ++$cnt;
  33. ++$vowels['o'];
  34. }
  35. if(strtolower($string[$i]) == 'u') {
  36. ++$cnt;
  37. ++$vowels['u'];
  38. }
  39. }
  40. echo "<h1>Total number of vowels found : ".$cnt."<h1>";
  41. echo "Occurence of 'a' : ".$vowels['a']."<br>";
  42. echo "Occurence of 'e' : ".$vowels['e']."<br>";
  43. echo "Occurence of 'i' : ".$vowels['i']."<br>";
  44. echo "Occurence of 'o' : ".$vowels['o']."<br>";
  45. echo "Occurence of 'u' : ".$vowels['u']."<br>";
  46. $str=strrev($string);
  47. $a=strlen($string);
  48. $f=0;
  49. for($j=0;$j<$a;$j++)
  50. {
  51. if($str[$j]==$string[$j])
  52. {
  53. $f=0;
  54. }
  55. else
  56. {
  57. $f=1;
  58. break;
  59. }
  60. }
  61. if($f==0)
  62. {
  63. echo"string is palindrome";
  64. }
  65. else
  66. {
  67. echo"string is not palindrome";
  68. }
  69. ?>
  70.  
Success #stdin #stdout #stderr 0.02s 26312KB
stdin
Standard input is empty
stdout
<html>
<body>
<form method="GET" action="First.php">
Enter the String : <input type="text" name="inputStr"><br>
<input type="submit" name="Submit">
</form>
</body>
</html>

First.php

<h1>Total number of vowels found : <h1>Occurence of 'a' : 0<br>Occurence of 'e' : 0<br>Occurence of 'i' : 0<br>Occurence of 'o' : 0<br>Occurence of 'u' : 0<br>string is palindrome
stderr
PHP Notice:  Undefined index: inputStr in /home/Q99qaR/prog.php on line 14
PHP Notice:  Undefined variable: cnt in /home/Q99qaR/prog.php on line 40