Home Tutorial Php Phpbeginners Comparison Operators


Share on Google+Share on Google+
Comparison Operators
Posted on: February 4, 2011 at 12:00 AM
This section contains the detail about Comparison Operator in PHP.

Comparison Operators

Operator is used to perform operation on variable and values. Comparison Operators are used to compare two values.

Given below the complete list of available comparison operator in PHP :

= = is equal to 5= =8 returns false
!= is not equal 5!=8 returns true
<> is not equal 5<>8 returns true
> is greater than 5>8 returns false
< is less than 5<8 returns true
>= is greater than or equal to 5>=8 returns false
<= is less than or equal to 5<=8 returns true

Given below example will give you a clear idea how to use comparison operator :

Example :


echo $a=$b ? "true\n" : "false\n";
echo "<br/>";
echo $b!=$c ? "true\n" : "false\n";
echo "<br/>";
echo $c>$a ? "true\n" : "false\n";


Output :



Related Tags for Comparison Operators:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 4, 2011

Recommend the tutorial

Advertisements Advertisements