Showing posts with label check. Show all posts
Showing posts with label check. Show all posts

Wednesday, 5 June 2013

How to check vowels in php

A vowel is a speech sound made by the vocal cords. It is also a type of letter in the alphabet.
There are 5 vowel are there. A, E, I, O, U.

<?php 
     $char = 'a';    // input character
     switch ($char){
         case 'a':
         case 'A':
         case 'e':
         case 'E':
         case 'i':
         case 'I':
         case 'o':
         case 'O':
         case 'u':
         case 'U':
       
         echo "character $char is a vowel";
             break;
         default :
             echo "character $char is not a vowel";
}
?>
Output is:
character a is a vowel