php
PHP Switch Statement

The PHP switch-case statement is an alternative to the if-elseif-else statement. PHP switch statement is used to execute one statement from multiple conditions.

switch(…){…} is the control structure block code

case value : case… are the blocks of code to be executed depending on the value of the condition

default : is the block of code to be executed when no value matches with the condition

Syntax
switch(expression){      
case value1:      
 //code to be executed  
 break;  
case value2:      
 //code to be executed  
 break;  
......      
default:       
 //Code to be executed if all cases are not matched;    
The following example of switch statement.
<!DOCTYPE html>
<html>
<head>
	<title>PHP Switch Statement</title>
</head>

<body>

<?php
$today = date("D");
switch($today){
    case "Mon":
        echo "Today is Monday.";
        break;
    case "Tue":
        echo "Today is Tuesday.";
        break;
    case "Wed":
        echo "Today is Wednesday.";
        break;
    case "Thu":
        echo "Today is Thursday.";
        break;
    case "Fri":
        echo "Today is Friday.";
        break;
    case "Sat":
        echo "Today is Saturday.";
        break;
    case "Sun":
        echo "Today is Sunday.";
        break;
    default:
        echo "No information available for that day.";
        break;
}
?>

</body>
</html>
Output :

The break statement tells PHP to break out of the switch-case statement block once it executes the code associated with the first true case.