PHP can perform simple mathimatical operations all the way to complex
trigonometric equations. The operator symbols used all make good sense
for the mathematical action they perform.
Here are the arithmetic symbols and how to apply them in the most basic
way:
<?php
// Set a couple of sample integer variables
$var1 = 5;
$var2 = 3;
// Addition >>> Sum of $var1 and $var2
echo $var1 + $var2;
echo "<br />";
// Subtraction >>> Difference of $var1 and $var2
echo $var1 - $var2;
echo "<br />";
// Multiplication >>> Product of $var1 and $var2
echo $var1 * $var2;
echo "<br />";
// Division >>> Quotient of $var1 and $var2
echo $var1 / $var2;
echo "<br />";
//Modulus >>> Remainder of $var1 divided by $var2
echo $var1 % $var2;
echo "<br />";
//Negation >>> Opposite of $var1
echo -$var1;
?>
8
2
15
1.66666666667
2
-5