Math and Arithmetic Operators

Addition: 30


Definition: The addition operator (+) adds two operands. In this example, the values of variables `$a` and `$b` are 10 and 20 respectively, and the result of the addition is stored in the `$sum` variable.

Subtraction: 20


Definition: The subtraction operator (-) subtracts the second operand from the first operand. In this example, the values of variables `$c` and `$d` are 30 and 10 respectively, and the result of the subtraction is stored in the `$difference` variable.

Multiplication: 50


Definition: The multiplication operator (*) multiplies two operands. In this example, the values of variables `$e` and `$f` are 5 and 10 respectively, and the result of the multiplication is stored in the `$product` variable.

Division: 4


Definition: The division operator (/) divides the first operand by the second operand. In this example, the values of variables `$g` and `$h` are 100 and 25 respectively, and the result of the division is stored in the `$quotient` variable.

Modulus: 5

Definition: The modulus operator (%) returns the remainder of the division of the first operand by the second operand. In this example, the values of variables `$i` and `$j` are 33 and 7 respectively, and the result of the modulus operation is stored in the `$remainder` variable. Code Source