Arithmetic Operators : Arithmetic Operators « Operator « PHP






Arithmetic Operators

 
Example           Operation              Result 
-$a               Negation               Negative value of $a 
$a + $b           Addition               Sum of $a and $b 
$a - $b           Subtraction            Difference of $a and $b 
$a * $b           Multiplication         Product of $a and $b 
$a / $b           Division               Quotient of $a and $b 
$a % $b           Modulus                Remainder of $a divided by $b
  
  








Related examples in the same category

1.Arithmetical Operators
2.An example of PHP's automatic type conversion is the addition operator '+'.
3.Changing the default precedence using parentheses
4.Increment/decrement Operators
5.Incrementing and decrementing
6.Using the autodecrement operator
7.Using the negation operator
8.Using pre- and postincrement
9.Using autoincrement to add to a variable
10.Postfix and Prefix Operators summary table
11.Peculiarities of the ++ and -- Operators
12.postfix and prefix increment operators also work on letter values
13.Postfix and Prefix Operators in Action
14.Calculation Results for Postfix and Prefix Operators
15.Shorthand Operators summary table
16.Variables Are Assigned by Value
17.Using Assignment Operators