PHP Program to check the letter is vowel or consonant 

A vowel is a speech sound made with your mouth fairly open, the nucleus of a spoken syllable. A consonant is a sound made with your mouth fairly closed. There are about 20 vowels and 24 consonants. The below program checks whether the given letter is vowel-like a,e, i,o,u, or consonant like the rest of the letters. Vowels and consonants combine to form words. The letter ‘y’ is unique in that it can function as a consonant and a vowel at the same time. It will help you spell if you understand how vowels and consonants work together to form words and sounds.

ALGORITHM

STEP 1: Read the letter

STEP 2: Using a switch() condition check whether the letter is equal to a, e, i, o, u or A, E, I, O, U

STEP 3: If the condition matches then display the message 'it is vowel' and exit from the switch function using break statement

STEP 4: If the condition fails then, display the message 'it is consonant' and exit from the switch condition using break statement

 

PHP Source Code

                                          <?php 
$ch = 'D'; 
switch ($ch) 
{ 
case 'a': 
echo "it is vowel"; 
break; 
case 'e': 
echo "it is vowel"; 
break; 
case 'i': 
echo "it is vowel"; 
break; 
case 'o': 
echo "it is vowel"; 
break; 
case 'u': 
echo "it is vowel"; 
break; 
case 'A': 
echo "it is vowel"; 
break; 
case 'E': 
echo "it is vowel"; 
break; 
case 'I': 
echo "it is vowel"; 
break; 
case 'O': 
echo "it is vowel"; 
break; 
case 'U': 
echo "it is vowel"; 
break; 
default: 
echo "it is consonant"; 
break; 
} 
?> 
                                      

OUTPUT

it is consonant