Below are 9 examples of using arithmetic operators in PHP.

(AKA Part 5 for Assignment 3)

My numbers for examples 1-5 are 12 and 4.

Ex. 1 Addition: 12 + 4 = 16

Ex. 2 Subtraction: 12 - 4 = 8

Ex. 3 Multiplication: 12 x 4 = 48

Ex. 4 Division: 12 / 4 = 3

Ex. 5 Modulus is the remainder of 12/4: 0

My beginning number for examples 6-9 is 21.

Ex. 6 Pre-increment: 22.

Ex. 7 Post-increment: 21 to 22.

Ex. 8 Pre-decrement: 20.

Ex. 9 Post-decrement: 21 to 20.

My explanations:

For example 1: This operator adds the two numbers together.

For example 2: This operator subtracts the second number from the first number.

For example 3: This operator multiplies the first number by the second number.

For example 4: This operator divides the first number by the second number.

For example 5: This operartor outputs the leftover value from dividing the first number by the second number.

For example 6: When placed before the variable this operator automatically increments the variable by 1.

For example 7: When placed after the variable this operator when first echoed displays the original variable's value, then when echoed a second time it displays the orginal value incremented by 1.

For example 8: When placed before the variable this operator automatically decrements the variable by 1.

For example 9: When placed after the variable this operator when first echoed displays the original variable's value, then when echoed a second time it displays the orginal value decremented by 1.