Showing posts with label remove vowels in php. Show all posts
Showing posts with label remove vowels in php. Show all posts

Friday, March 20, 2015

Remove Vowels Program in PHP


In this article I would like to share with you a sample program that will remove vowels in a given string or sentence of our user I called this program remove vowels written in PHP as our programming language. What does our program will do is to ask the user to enter any string or sentence then our program will remove or delete vowels that can be found in a given string or sentence. Regardless if the string is lower case or upper case format. I hope you will find my work useful in your learning string manipulation in PHP.


If you have some questions please send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com

People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360




Program Listing

<html>
<title> Remove Vowels Program</title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 
</style>


<?php

error_reporting(0);
$values = $_POST['value'];

$values2 = $values;
if(isset($_POST['check'])) {

  if ($values==" ") {
      echo "<script>";  
  echo "alert('It Cannot Be Empty!!! Please enter a sentence.');";
  echo "</script>";
  $values=" ";
  $results=" ";
     }
 
 if ($values != " ") {
 
   $total_vowels = 0; $total_consonants=0;

      $vowels = Array('a','e','i','o','u','A','E','I','O','U');
      $vowels = Array('a','e','i','o','u','A','E','I','O','U');

   $results .=  "========================<br> ";  
   $results .=  "==== DISPLAY RESULT ====<br> ";
   $results .=  "========================<br>";  
   $results .=  "<br>";
   $results .= "The word or sentence is   :=>   " .$values."<br><br>";
   
for ($b=0;$b<strlen($values);$b++)
{
    for ($a = 0;$a<10;$a++)
        if ($values[$b] == $vowels[$a])
        {
            $values[$b]=" ";
            break;
        }
  }
   $results .= "Remove Vowel Sentence  :=>  " .$values."<br>";   
   
   }
  
    }
  
   
if(isset($_POST['clear'])) {
  $values2=" "; 
  $results= " ";
  
}

?>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center">REMOVE VOWELS PROGRAM </h2>
  <br>
<form action="" method="post">
 Enter a Word Or Sentence : <input type="text" name="value"    value="<?php echo $values2; ?>" 
 autofocus  size=60/>
 <br><br>
   <input type="submit" name="check" value="Remove Vowels" 
  title="Click here to remove vowels in a given sentence."/>
  <input type="submit" name="clear" value="Clear" 
  title="Click here to clear text box and values on the screen"/>
</form>
<br>
<?php 
echo $results;
 ?>
  </body>
</html>