Arithmetic Operators in PHP

Arithmetic Operators in PHP
Rating: 5 - 1 Votes

Arithmetic Operators in PHP

phpLike any other programming language, we do have integer and float data types in PHP.  Integers are whole numbers, can have both positive and negative values like -1, -2, 1, 3 etc.  Floats are known as decimal numbers like 1.25, 3.2 etc.  Using integers and floats, we can perform numerical calculations like addition, subtraction, division etc.  To do so, we make use of arithmetic operators such as:

  • Addition (+)
  • Subtraction ()
  • Multiplication (*)
  • Division (/)
  • Modulus (%)

Example is given below for all the above listed arithmetic operators.