PHP Arithmetic Operators With Example

aimtocode

Arithmetic Operators:

The PHP arithmetic operators are used with numeric values to perform common arithmetical operations, such as addition, subtraction, multiplication division etc.

List of Arithmetic Operators


Operator Description Example Result
+ Addition $x + $y Sum of $x and $y
- Subtraction $x - $y Difference of $x and $y.
* Multiplication $x * $y Product of $x and $y.
/ Division $x / $y Quotient of $x and $y
% Modulus $x % $y Remainder of $x divided by $y



Example:



Result:

14
6
40
2.5
2 

Read Also:


aimtocode