-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArithmetic-Operators.php
57 lines (45 loc) · 1.28 KB
/
Arithmetic-Operators.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Arithmetic Operator in PHP</title>
</head>
<body>
<?php
# Operator is a set of symbol that represent an action or calculation
# It is used to perform an operation on one or more values called operands to produce a result
# Arithmetic Operators are used to perform arithmetic operation on operands
# Defining variables
$a=90;
$b=89;
echo "<p>Arithmetic Operators in PHP</p>";
# Addition +
$add=$a + $b;
echo "<p> Using Addition + Operator</p>";
echo "<p> $a + $b = $add</p>";
# Subtraction -
$sub=$a - $b;
echo "<p> Using Subtraction - Operator</p>";
echo "<p> $a - $b = $sub</p>";
# Multiplication *
$mul=$a * $b;
echo "<p> Using Multiplication * Operator</p>";
echo "<p> $a * $b = $mul</p>";
# Division /
$div=$a / $b;
echo "<p> Using Division / Operator</p>";
echo "<p> $a / $b = $div</p>";
# Modulus %
# Gives Reamainder of division
$mod=$a % $b;
echo "<p> Using Modulus % Operator</p>";
echo "<p> $a % $b = $mod</p>";
# Exponentiation **
# Gives Exponent of value
$exp=$a ** $b;
echo "<p> Using Exponentiation ** Operator</p>";
echo "<p> $a ** $b = $exp</p>";
?>
</body>
</html>