Comparison Operators

Comparison operators, as their name implies, allow you to compare two values. You may also be interested in viewing the type comparison tables, as they show examples of various type related comparisons.
Comparison Operators


Example
Name
Result




$a == $b
Equal
TRUE if $a is equal to $b after type juggling.


$a === $b
Identical
TRUE if $a is equal to $b, and they are of the same type. (introduced in PHP 4)


$a != $b
Not equal
TRUE if $a is not equal to $b after type juggling.


$a <> $b
Not equal
TRUE if $a is not equal to $b after type…

Leer artículo completo →