<?php
$day = "Monday";
switch ($day) {
case "Monday":
echo "Start of the week!";
break;
case "Friday":
echo "Weekend is near!";
break;
default:
echo "Just another day.";
}
?>
Explanation:
switchis an alternative to multipleif-elsestatements.- If
$day = "Monday", output will be Start of the week!
Leave a Reply