Equality Operators in action : Comparison Operators « Operator « PHP






Equality Operators in action




<html>
<head>
   <title>Equality</title>
</head>
<body>
     <?php
          $a = 1;
          $b = "1";
   
          print("(\$a == \$b)" . (($a == $b) ? "True" : "False") . "<br />");
          print("(\$a != \$b)" . (($a != $b) ? "True" : "False") . "<br />");
          print("(\$a === \$b)" . (($a === $b) ? "True" : "False") . "<br />");
          print("(\$a !== \$b)" . (($a !== $b) ? "True" : "False") . "<br />");
     ?>
</body>
</html>
           
       








Related examples in the same category

1.Comparison Operators
2.Comparing numbers and strings
3.Loose Comparison Operators
4.Using Comparison Operators in if Statements
5.The Ternary Operator
6.The equality operator
7.These values are compared using dictionary order
8.These values are compared using numeric order
9.Equality Operators summary table