-
Notifications
You must be signed in to change notification settings - Fork 0
/
switch.php
52 lines (46 loc) · 891 Bytes
/
switch.php
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
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
// Set the default timezone
date_default_timezone_set('America/Chicago');
// Get Day of Week as number
// 1 (for Monday) through 7 (for Sunday)
$dayOfWeek = date('N');
switch($dayOfWeek) {
case 1:
$day = 'Monday';
break;
case 2:
$day = 'Tuesday';
break;
case 3:
$day = 'Wednesday';
break;
case 4:
$day = 'Thursday';
break;
case 5:
$day = 'Friday';
break;
case 6:
$day = 'Saturday';
break;
case 7:
$day = 'Sunday';
break;
}
fwrite(STDOUT, $day . PHP_EOL);
if ($dayOfWeek == 1) {
$day2 = 'Monday';
} elseif ($dayOfWeek == 2) {
$day2 = 'Tuesday';
} elseif ($dayOfWeek == 3) {
$day2 = 'Wednesday';
} elseif ($dayOfWeek == 4) {
$day2 = 'Thursday';
} elseif ($dayOfWeek == 5) {
$day2 = 'Friday';
} elseif ($dayOfWeek == 6) {
$day2 = 'Saturday';
} elseif ($dayOfWeek == 7) {
$day2 = 'Sunday';
}
fwrite(STDOUT, $day2 . PHP_EOL);