forked from assembler-institute/php-basics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconditionals.php
More file actions
53 lines (42 loc) · 1.09 KB
/
Copy pathconditionals.php
File metadata and controls
53 lines (42 loc) · 1.09 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
# WEEK CONDITION
$findDay = date('w');
if ($findDay == 1) echo 'We are on Monday';
# MONTH CONDITION
$findMonth = date('m');
if ($findMonth == 10) echo 'We are in October';
# DOUBLE CONDITION
$forMinutes = date('i');
if ($forMinutes <= 10) {
echo "the current minute is less than 10, ";
} else if ($forMinutes >= 15) {
echo "the current minute is more than 15, ";
} else {
echo "does not meet any conditions, ";
}
echo "the current minutes are ".$forMinutes."<br><br>";
# SWITCH
switch ($findDay) {
case 0:
echo 'Hoy es domingo';
break;
case 1:
echo 'Hoy es lunes';
break;
case 2:
echo 'Hoy es martes';
break;
case 3:
echo 'Hoy es miercoles';
break;
case 4:
echo 'Hoy es jueves';
break;
case 5:
echo 'Hoy es viernes y el cuerpo lo sabe';
break;
case 6:
echo 'Hoy es sabado';
break;
}
?>