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
47 lines (34 loc) · 936 Bytes
/
conditionals.php
File metadata and controls
47 lines (34 loc) · 936 Bytes
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
<?php
$day = "Monday";
$month = "December";
if($day == "Monday"){
echo "We are on Monday <br><br>";
}else echo "We are not on Monday <br><br>";
if($month == "October"){
echo "We are in October <br><br>";
}else echo "We are in " . date("F") . "<br><br>";
// Doble condition
$minute = 9;
if($minute < 10){
echo "the current minute is less than 10 <br><br>";
}elseif($minute>15){
echo "the current minute is more than 15";
}else echo "does not meet any conditions";
// Switch
$today = "friday";
switch($today){
case 'Monday':
echo "Let start the week <br><br>";
break;
case 'Wednesday':
echo "The are just three days more to finish the week! <br><br>";
break;
case 'friday':
echo "The last working day <br><br>";
break;
case 'Sunday':
echo "Tomorrow we will start again <br><br>";
break;
default: echo "nothing to do";
}
?>