PHP Arithmetic Operators Examples

Addition ($a + $b): 19

Subtraction ($a - $b): 11

Multiplication ($a * $b): 60

Division ($a / $b): 3.75

Modulus ($a % $b): 3

What each operator does:

The addition operator (+) adds two numbers together and returns their sum.

The subtraction operator (-) subtracts the second number from the first one and returns the difference.

The multiplication operator (*) multiplies two numbers and returns the product.

The division operator (/) divides the first number by the second and returns the quotient.

The modulus operator (%) returns the remainder after division of one number by another, useful for checking divisibility.