PHP Programing language

adplus-dvertising
Comparison or Relational Operator Examples
Previous Home Next

In PHP using the Comparison or Relational Operator :

OPERATOROPERATION
= = Equal
= = = Identical
!= Not equal
<> Not equal
!= = Not identical
< Less than
> Greater than
< = Less than or Equal to
>= Greater than or Equal to

Example for Comparison Operator

<html>
<head>
<title>Using Comparison Operator</title>
</head>
<body>
<h1>The example for using comparison operator</h1>
	<?php
	$s = 10;
	$a = 5;
	$y = "200 pack";
	$i = "hello";
	$o = "php";
	printf ("$s == $a :%d <br>", $s==$a);
	printf ("$s != $a :%d <br>", $s!=$a);
	printf ("$s <> $a :%d <br>", $s<>$a);
	printf ("$s === $y :%d <br>", $s===$y);
	printf ("$s !== $y :%d <br>", $s!==$y);
	printf ("$s > $a :%d <br>", $s > $a);
	printf ("$i > $o :%d <br>", $i > $o);
	printf ("$s < $a :%d <br>", $s < $a);
	printf ("$i < $o :%d <br>", $i < $o);
	printf ("$s >= $a :%d <br>", $s >= $a);
	printf ("$i >= $o :%d <br>", $i >= $o);
	printf ("$s <= $a :%d <br>", $s <= $a);
	printf ("$i <= $o :%d <br>", $i <= $o);
	?>
	</body>
	</html>
Previous Home Next