-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathif_else.php
More file actions
35 lines (31 loc) · 721 Bytes
/
if_else.php
File metadata and controls
35 lines (31 loc) · 721 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
<?php
$a = 5;
$b = 10;
$c = '10';
// TODO: Shorten these two if statements to a single if/else DONE
if ($a < $b) {
echo "$a is less than $b\n";
}
else ($a >= $b) {
echo "$a is greater than or equal to $b\n";
}
// TODO: Shorten these two if statements to a single if/else DONE
if ($b < $c) {
echo "$b is less than $c\n";
}
else ($b >= $c) {
echo "$b is greater than or equal to $c\n";
}
// TODO:
// combine the next 3 conditionals into one
// if/elseif/else block that checks in order for:
// identical, equal, not equal/identical DONE
if ($b === $c) {
echo "$b is identical to $c\n";
}
else if ($b == $c) {
echo "$b is equal to $c\n";
}
else ($b != $c) {
echo "$b is not equal to $c\n";
}