PHP Comparison Operators



PHP Has lot of comparison operators for using.
Operator Name Example Result
== Equal $p == $q Return true if $p becomes equal to $q
=== Identical $p === $q Returns true if $x is equal to $y, and they are of the same type
!= Not equal $p != $q Returns true if $x is not equal to $y
<> Not equal $p <> $q Returns true if $x is not equal to $y
!== Not identical $p!== $q Returns true if $x is not equal to $y, or they are not of the same type
> Greater than $p> $q Returns true if $x is greater than $y
< Less than $p< $q Returns true if $x is less than $y
>= Greater than or equal to $p>= $q Returns true if $x is greater than or equal to $y
<= Less than or equal to $p<= $q Returns true if $x is less than or equal to $y