Switch statement is a control statement that allows us to choose only one choice among the many given choices. it is a control statement used to make a selection between many alternatives.
Q.) W.A.P to design a calculator.
<html>
<body>
<?php
$ch=3;
switch($ch)
{
case 1:
echo “one”;
break;
case 2:
echo “Two”;
break;
case 3:
echo “Three”;
break;
default:
echo “ only 1 to 3”;
}
?>
</body>
</html>
Output
3
Three