We can do math with Arithmetic Operators.
When to use
Anytime you want to do any sort of math, you'll use arithmetic operators.
Math operators act just the way you'd think they do.
** or pow() exponent
% modulus (remainder)
You can use math operators on variables or on the numbers directly themselves:
echo $num1 + $num2;
echo 3 + 5;
Hints & tips
- Arithmetic operators allow us to do math.
- They work exactly how you'd think they would.
Lesson notes are only available for subscribers.