Skip to content

Commit 5204120

Browse files
author
dima_los
committed
Added Tutorial 8 code
1 parent 773a365 commit 5204120

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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);
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
}

0 commit comments

Comments
 (0)