PHP Arithmetic Operators

← Back to Index


Using $a = 20 and $b = 6 for all examples.

Operator Symbol Expression Result
Addition + $a + $b 26
Subtraction - $a - $b 14
Multiplication * $a * $b 120
Division / $a / $b 3.3333
Modulus % $a % $b 2
Exponentiation ** $a ** 2 400

Operator Descriptions

Addition (+): Adds two values together. 20 + 6 = 26.
Subtraction (-): Subtracts the right value from the left. 20 - 6 = 14.
Multiplication (*): Multiplies two values. 20 * 6 = 120.
Division (/): Divides the left value by the right. 20 / 6 = 3.3333.
Modulus (%): Returns the remainder after division. 20 % 6 = 2 because 6 goes into 20 three times with 2 left over.
Exponentiation (**): Raises the left value to the power of the right. 20 ** 2 = 400.

INFOST 440 — Activity 3 — Nyla Broughton