-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoperators.php
61 lines (51 loc) · 1.15 KB
/
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
58
59
60
61
<?php
echo "<h1> Operators in php </h1>";
echo "<br>";
echo " <h3>1. Arithmetic operators</h3> ";
$a = 5; $b = 3;
echo "<br>";
echo "a = $a and b = $b <br>";
echo "a+b = ".($a+$b);
echo "<br>";
echo "a-b = ".($a-$b);
echo "<br>";
echo "a*b = ".($a*$b);
echo "<br>";
echo "a/b = ".($a/$b);
echo "<br>";
echo "a%b = ".($a%$b);
echo "<br>";
echo "a^b = ".($a**$b)." (** is used)";
echo "<br>";
echo " <h3>2. Assignment operators</h3> ";
$a+= ($a+$b);
echo "<br>";
echo "Now a = ".$a;
echo "<br>";
echo " <h3>3. Comparison operators</h3> ";
echo "<br>";
echo "for a==y , the res = <br>";
echo var_dump($a==$b);
echo "<br>";
echo "<> is notequal ";
echo "<br>";
echo "> is greater than ";
echo "<br>";
echo "< is less than ";
echo "<br>";
echo ">= is greater than equal to ";
echo "<br>";
echo "<= is less than equal to ";
echo "<br>";
echo " <h3>4. Logical operators</h3> ";
echo "and --> both true for true";
echo "<br>";
echo "&& --> both true for true";
echo "<br>";
echo "or --> if any 1 true for true";
echo "<br>";
echo "|| --> if any 1 true for true";
echo "<br>";
echo "!a (not a)";
echo "<br>";
?>