MATH
Addition: 5 + 10 = 15
Subtraction: 5 - 10 = -5
Multiplication: 5 * 10 = 50
Division: 5 / 10 = 0.5
Modulus: 5 % 10 = 5
Pre-increment: ++$a = 6
Post-increment: $a++ = 6 (then becomes 7 after the operation)
Pre-decrement: --$a = 6
Post-decrement: $a-- = 6 (then becomes 5 after the operation)
Understanding PHP Arithmetic Operators
Arithmetic operators are used to perform mathematical operations on
numbers. Below are the examples:
- Addition (+): Adds two numbers together.
- Subtraction (-): Subtracts one number from another.
- Multiplication (*): Multiplies two numbers.
- Division (/): Divides one number by another.
- Modulus (%): Returns the remainder of a division.
- Pre-increment (++$a): Increments the value of a
variable before it's used in the expression.
- Post-increment ($a++): Increments the value of a
variable after it's used.
- Pre-decrement (--$a): Decreases the value of a
variable before it's used.
- Post-decrement ($a--): Decreases the value of a
variable after it's used.