main.php
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
54
55
56
57
58
59
60
61
62
63
/**** Math Operators****/

// Addition
$hrsPlayedMon = 10;
$hrsPlayedTues = 9;
$hrsTotal = $hrsPlayedMon + $hrsPlayedTues;
echo $hrsTotal . "\n";

// Subtraction
$hrsDifference = $hrsPlayedMon - $hrsPlayedTues;
echo $hrsDifference . "\n";
// Multiplication
define("NUMBER_WEEK_DAYS", 7);
$weekMultiple = NUMBER_WEEK_DAYS * $hrsPlayedMon;
echo $weekMultiple;
echo "\n";

// Division
$daysCounter = 2;
$avgDailyHours = $hrsTotal / $daysCounter;
echo $avgDailyHours;
echo "\n";

// Exponents
$monSquared = $hrsPlayedMon ** 2;
echo $monSquared;
echo "\n";

// Negation
$monOpposite = -$hrsPlayedMon;
echo $monOpposite;
echo "\n";
echo -$hrsPlayedMon;
echo "\n";

// Modul: Remainder of $a % $b
echo $hrsTotal % $daysCounter;
echo "\n";

// Post-increment: Returns $a, then increments $a by one.
$currentLevel = 1;
echo 'You completed level: ' . $currentLevel++;
echo "\n";
echo "You are now on level ".$currentLevel;
echo "\n";
// Pre-increment:  Increments $a by one, then returns $a
$currentLevel = 1;
echo ++$currentLevel;
echo " ".++$currentLevel;
echo "\n";
// Post-decrement:  Returns $a, then decrements $a by one.
$livesLeft = 3;
echo $livesLeft-- . " ";
echo $livesLeft-- . " ";
echo $livesLeft-- . " ";
echo "\n";
// Pre-decrement:  	Decrements $a by one, then returns $a.
$liveLeft = 3;
echo --$liveLeft . " ";
echo --$liveLeft . " ";
echo --$liveLeft . " ";
echo "\n";
PHP 7.0.8 (cli) (built: Jun 23 2016 23:39:14) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies