Mathematical Operators are important in programming as alot of things are based on numbers, and of course you also work with numbers, so having a good idea of the different operators is nice.
$a = 27; // Switches $a over to a float of 27.00 +$a
$b = 27; // Switches $b over to a negative int of -27 -$b
$a = 10; $b = 6; // Results in 16 $a + $b
$a = 10; $b = 6; // Results in 4 $a - $b
$a = 10; $b = 6; // Results in 60 $a * $b
$a = 12; $c = 10; $b = 6; $d = 3; // Results in an int of 2 $a / $b // Results in a float of 3.333.. $c / $d
$a = 3; $b = 3; // Results in 27 $a ** $b
Modulo is very interesting, as it gives you the left over int of a division (you can also use floats with fmod(). This can be used to for example, access every {n}th key of an array.
$a = 4; $b = 3; // Results in 1 $a % $b // Can be used for arrays like so: $evilArray = [ 'evil', 'evil', 'good', 'evil', 'evil', 'good', 'evil', 'evil', 'good', ]; foreach ($evilArray as $key => $value) { if ($key % 3 === 0) { $goodArray[] = $value; } } // Good array looks like this after $goodArray = [ 'good', 'good', 'good', ];