PHP Arithmetic Operators

Arithmetic Examples

20 + 5 = 25

20 - 5 = 15

20 * 5 = 100

20 / 5 = 4

20 % 5 = 0

Explanation of the Operators

Addition (+): The addition operator adds two numbers together. In this example, 20 + 5 equals 25.

Subtraction (-): The subtraction operator subtracts the second number from the first. In this example, 20 - 5 equals 15.

Multiplication (*): The multiplication operator multiplies two numbers together. In this example, 20 * 5 equals 100.

Division (/): The division operator divides one number by another. In this example, 20 / 5 equals 4.

Modulus (%): The modulus operator returns the remainder after division. In this example, 20 % 5 equals 0 because 20 divides evenly by 5.

Back to Activity 3 Home