File tree 2 files changed +49
-0
lines changed
tutorial-008-operators-p2
2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /**
4
+ * == - Equal <- ===
5
+ * != - Not Equal <- !==
6
+ * >= - Greater than or equal to
7
+ * <= - Less than or equal to
8
+ */
9
+
10
+ $ identicalResult = 2 === 2 ;
11
+ var_dump ($ identicalResult , 2 , 'Spider man ' );
12
+
13
+ var_dump ($ identicalResult );
14
+ var_dump (2 );
15
+ var_dump ('Spider man ' );
16
+
17
+
18
+ var_dump (2 === '2 ' );
19
+ var_dump (2 == '2 ' );
20
+ var_dump (true == 1 );
21
+ var_dump (true == '0 ' );
22
+ var_dump (3 <= 2 );
23
+ var_dump (3 < 2 || 3 === 2 );
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ $ playerEnergy = 40 ;
4
+ $ shieldCharged = false ;
5
+ $ droneAlert = false ;
6
+
7
+
8
+ if ($ droneAlert ) {
9
+ if ($ playerEnergy < 100 ) {
10
+ if ($ shieldCharged ) {
11
+ echo 'Your personal shield is charged. This will deflect incoming laser shots!<br> ' ;
12
+ } elseif ($ playerEnergy > 50 && $ droneAlert ) {
13
+ echo 'Your shield is uncharged, but you"ll probably survive the incoming attack!<br> ' ;
14
+ } else {
15
+ echo 'You are in danger! Charge your shield as soon as possible!<br> ' ;
16
+ }
17
+
18
+ echo 'Your energy is below maximum. Find another energy cell!<br> ' ;
19
+ } else {
20
+ echo 'You have maximum energy level!<br> ' ;
21
+ }
22
+
23
+ echo 'Warning! Enemy drone detected in proximity! Take cover or disable it!<br> ' ;
24
+ } else {
25
+ echo 'We are safe for now and have some time to recover before the next attack. <br> ' ;
26
+ }
You can’t perform that action at this time.
0 commit comments