| Operator | Name | Result |
|---|---|---|
| $a == $b | Equal | TRUE if $a is equal to $b. |
| $a === $b | Identical | TRUE if $a is equal to $b, and they are of the same type. Useful for String comparisons if($a==="string") |
| $a != $b | Not Equal | TRUE if $a is not equal to $b. |
| $a <> $b | Not Equal | TRUE if $a is not equal to $b. |
| $a !== $b | Not Identical | TRUE if $a is not equal to $b, or they are not of the same type. Useful for String comparisons if($a!=="string") |
| $a < $b | Less Than | TRUE if $a is strictly less than $b. |
| $a > $b | Greater Than | TRUE if $a is strictly greater than $b. |
| $a <= $b | Less Than or Equal to | TRUE if $a is less than or equal to $b. |
| $a >= $b | Greater Than or Equal to | TRUE if $a is greater than or equal to $b. |
| Operand 1 | Operand 2 | Result |
|---|---|---|
| Null or String | String | Convert NULL to "", numerical or lexical comparison |
| Bool or Null | Anything | Convert to bool, FALSE < TRUE |
| Object | Object | Built-in classes can define its own comparison, different classes are incomparable, same class - compare properties the same way as arrays (PHP 4), PHP 5 lets you define your own comparison mechanism. |
| String, Resource or Number | String, Resource or Number | Translate strings and resources to numbers, usual math |
| Array | Array | Array with fewer members is smaller, if key from operand 1 is not found in operand 2 then arrays are incomparable, otherwise - compare value by value |
| Array | Anything | Array is always greater. |
| Object | Anything | Object is always greater. |