PHP Comparison Operators
The PHP comparison operators are used to compare two values (number or string):| Operator | Name | Example | Result | Show it |
|---|---|---|---|---|
| == | Equal | $x == $y | Returns true if $x is equal to $y | |
| === | Identical | $x === $y | Returns true if $x is equal to $y, and they are of the same type | |
| != | Not equal | $x != $y | Returns true if $x is not equal to $y | |
| <> | Not equal | $x <> $y | Returns true if $x is not equal to $y | |
| !== | Not identical | $x !== $y | Returns true if $x is not equal to $y, or they are not of the same type | |
| > | Greater than | $x > $y | Returns true if $x is greater than $y | |
| < | Less than | $x < $y | Returns true if $x is less than $y | |
| >= | Greater than or equal to | $x >= $y | Returns true if $x is greater than or equal to $y | |
| <= | Less than or equal to | $x <= $y | Returns true if $x is less than or equal to $y |