Arithmetic Operators
The table below
lists arithmetic operators along with description and examples.
In the examples
below A = 10 and B = 20
Example: Working
with Arithmetic Operators
Script:
Arith_op.php
<html>
<head>
<title>Arithmetical
Operators</title></head>
<body>
<?php
$a = 20;
$b = 35;
$c = $a + $b;
echo "Addtion
Operation Result: $c <br/>";
$c = $a - $b;
echo
"Substraction Operation Result:$c<br/>";
$c = $a * $b;
echo
"Multiplication Operation Result: $c <br/>";
$c = $a / $b;
echo
"Division Operation Result: $c <br/>";
$c = $a % $b;
echo
"modulus Operation Result: $c <br/>";
$c = $a++;
echo
"Increment Operation Result:
$c
<br/>";
$c = $a--;
echo
"Decrement Operation Result:
$c
<br/>";
?>
</body>
</html>
OUTPUT:
Addition
Operation Result:55
Subtraction
Operation Result:-15
Multiplication
Operation Result:700
Division
Operation Result:0.57142857142857
Modulus Operation
Result:20
Increment
Operation Result:20
Decrement
Operation Result:21