Write a php program to print vowel or consonant using switch case

Write a php program to print vowel or consonant using switch case. This program will check the letter is vowel or consonant in PHP. This will check and whether the letter is vowel like a,e,i,o,u or consonant like rest of 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.

<?php 
$ch = 'D';
switch ($ch)
{
case 'a':
echo "it is vowel";
break;
case 'e':
echo "it is vowel";
break;
case 'i':
echo "itis 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

What is the purpose of echo in php

echo is a statement that displays the output of a command. echo() and echo can be used with or without parentheses. echo does not produce a result. In echo, several strings can be separated by a comma (,). The echo statement is quicker than the print statement.

What is vowel in php programming

An open sound is represented by a vowel, which is a letter. In the English language, there are six vowels: a, e, I o, u, and y. The letter Y is sometimes a vowel, like in the word narrative, but it can also be a consonant, as in the word yes. Vowels indicate voice sounds that are open and frictionless.

What is consonant in php programming

A consonant is a sound that is not a vowel in speech. It also refers to the letters of the alphabet that represent certain sounds: consonants include Z, B, T, G, and H. All non-vowel sounds, or their equivalent letters, are consonants: A, E, I, O, U, and occasionally Y are not consonants.

Why do we have vowels and consonant

Vowels and consonants are sounds, not letters, with vowels forming the nuclei of each syllable and consonants separating them. Consonants are spelled with the letters B, C, D, F, J, K, M, N, P, Q, S, T, V, X, and Z. The letters A and O are mostly employed to spell vowels, while E, G, H, I, L, R, U, W, and Y are used to represent both vowels and consonants.

What is uses of switch case in php

The switch-case statement is a substitute for the if-else if-else statement, which accomplishes the same goal. The switch-case statement compares a variable to a set of values until it finds one that matches, and then executes the code block that corresponds to that match. The value of the expression is then compared to the values in the structure for each case. If a match is found, the code block associated with that case is run. Break the code to prevent it from automatically moving on to the next scenario. If no match is discovered, the default statement is used.