-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitch_Case.php
More file actions
39 lines (35 loc) · 1.01 KB
/
Switch_Case.php
File metadata and controls
39 lines (35 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* Program: Switch Case Demonstration
* Description: Uses a switch statement to display the day of the week.
*/
$day = date("w"); // Get current day of the week (0 for Sunday, 6 for Saturday)
echo "<h2>Switch Case: Day of the Week</h2>";
echo "Today is: ";
switch ($day) {
case 0:
echo "<strong>Sunday</strong> - Time to relax!";
break;
case 1:
echo "<strong>Monday</strong> - Back to work/college.";
break;
case 2:
echo "<strong>Tuesday</strong> - Keeping the momentum.";
break;
case 3:
echo "<strong>Wednesday</strong> - Hump day!";
break;
case 4:
echo "<strong>Thursday</strong> - Almost there.";
break;
case 5:
echo "<strong>Friday</strong> - Weekend is coming!";
break;
case 6:
echo "<strong>Saturday</strong> - Enjoy your weekend!";
break;
default:
echo "Invalid day!";
}
echo "<br><br>Note: This program uses the server's current date to determine the day.";
?>