PHP switch

break: Used to stop the processing after going through the selected case. If not, the computer will continue processing through the rest of the switch statement.

Example 1:
<?php
$color="white";
switch ($color)
{
case "white":
echo "White as snow";
break;

case "red":
echo "Red as blood";
break;

case "blue":
echo "Blue as the ocean";
break;

case "green":
echo "Green as the leaves";
break;

default:
echo "Please select a color given in the box";
}
?>

Example 2:
<?php
$access_level="medium";
switch($access_level)
{
case low:
$access_type="view mode only";
break;


case medium:
$access_type="view and amend only";
break;

case high:
$access_type="view and amend and delete";
break;

case top:
$access_type="do anything";
break;

default:
echo "<b>$PHP_SELF: Error Unknown level . . . now existing . . .Good Bye</b>";
exit;



}

echo "<b> Welcome, you can $access_type on the system, good luck!<b>";
?>