PHP Arithmetic Operators

For these examples, $a = 20 and $b = 6.

Addition (+)

The plus sign adds two numbers together. 20 + 6 = 26

Subtraction (-)

The minus sign subtracts the second number from the first number. 20 - 6 = 14

Multiplication (*)

The asterisk multiplies two numbers together. 20 * 6 = 120

Division (/)

The forward slash divides one number by another. 20 / 6 = 3.3333333333333

Modulus (%)

The percent sign returns the remainder after one number is divided by another. 20 % 6 = 2

Back to Activity 3