Write a program to show day of the week using switch


code:-
<?php
$day = "2";

switch ($day) {
    case "1":
        echo "It is Monday!";
        break;
    case "2":
        echo "It is today!";
        break;
    case "3":
        echo "It is Wednesday!";
        break;
    case "4":
        echo "It is Thursday!";
        break;
    case "5":
        echo "It is Friday!";
        break;
    case "6":
        echo "It is Saturday!";
        break;
    case "7":
        echo "It is Sunday!";
        break;
    default:
        echo "Invalid input";
}
?>
output:-
it is today!

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post