switch statement - how to use switch, case, break, default in php
switchstatement.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>switch statement - how to use switch, case, break, default in php</title>
</head>
<body>
<h2 style="color:DodgerBlue; font-style:italic">php example: using switch statement</h2>
<hr width="400" align="left" color="CornFlowerBlue" />
<br />
<?php
$Color="SaddleBrown";
switch($Color)
{
case Tan:
$Message="Color is: Tan";
break;
case SaddleBrown:
$Message="Color is: SaddleBrown";
break;
default:
$Message="no color match in our list";
}
echo "<div style='Padding-left:35px;padding-top:35px;padding-bottom:35px;padding-right:35px;Background-color:HotPink;Color:Snow;width:450px;'>";
echo $Message;
echo "</div>";
?>
</body>
</html>