Arithmetic Operator in Php


An operator is a symbol that represent a specific action.Operators are used to perform operations on variables and values.

 Arithmetic Operators
The Arithmetic Operators contain the basic operation on
+      Addition
-       Subtraction
*      Multiplication
/       Division
%     Modulus  (to calculate reminder)

Example
<!DOCTYPE html>
<html>
<head><title>expertcodingmaster.com</title>
</head>
<body>
<?php
$a = 20;
$b = 10;
echo $c = $a + $b . "<br>";
echo $c = $a - $b . "<br>";
echo $c = $a * $b . "<br>";
echo $c = $a / $b . "<br>";
echo $c = $a % $b . "<br>";
?>
</body>
</html>

The output of the above code
30
10
200
2
0

No comments: