Comparison Operators in PHP programming



Comparison Operators are used for compare two values.There are several types of comparison operators in PHP programming. See the details below.

Equal Operator : ==
Usage : ($x==$y) , It will return TRUE if value of $x is equal to $y, otherwise it will return FALSE.

Identical Operator : ===
It will check the value and type. Both should be same.
usage : ($x===$y), It will return TRUE if value and type of $x is same as value and type of $y, otherwise it will return FALSE.

Not Equal Operator : !=
Usage : ( $x != $y ), It will return TRUE if value of $x is not equal to value of $y, otherwise it will return FALSE.

Not Equal Operator : <>
Usage : ( $x <> $y ), It will return TRUE if value of $x is not equal to calue of $y, otherwise it will return FALSE.

Not Identical Operator : !==
Usage : ($x !== $y ), It will return TRUE if value of $x not equal to value of $y or type of $x is not same as type of $y.

Less than Operator : <
Usage ( $x < $y ), It will return TRUE if value of $x is less than the value of $y, Otherwise it will return FALSE.

Greater than Operator: >
Usage ( $x > $y ), It will return TRUE if value of $x is greater than the value of $y, Otherwise it will return FALSE.

Less than or Equal to Operator : <=
Usage ( $x <= $y ), It will return TRUE if value of $x is less than or Equal to value of $y, Otherwise it will return FALSE.

Greater than or Equal to Operator : >=
Usage ( $x >= $y ), It will return TRUE if value of $x is greater than or equal to value of $y, Otherwise it will return FALSE

These are the main comparison Operators in PHP. You should be very thorough about all these, because its usage is very much needed in our PHP script programming.