<?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:
switch
is an alternative to multipleif-else
statements.- If
$day = "Monday"
, output will be Start of the week!
Leave a Reply