PHP Operators

PHP Logical Operators
Name Syntax Result
and $a and $b TRUE if both $a and $b are TRUE.
and $a && $b TRUE if both $a and $b are TRUE.
or $a OR $b TRUE if either $a or $b is TRUE.
or $a || $b TRUE if either $a or $b is TRUE.
xor $a XOR $b TRUE if either $a or $b is TRUE, but not both
not ! $a TRUE if $a is not TRUE.
PHP Comparison Operators
Name Syntax Result
less than $a < $b TRUE if $a is strictly less than $b.
greater than $a > $b TRUE if $a is strictly greater than $b.
Lesser than or equal to $a <= $b TRUE if $a is greater than or equal to $b.
Greater than or equal to $a >= $b TRUE if $a is greater than or equal to $b.
equal $a == $b TRUE if $a is equal to $b after type juggling.
identical $a === $b TRUE if $a is equal to $b, and they are of the same type.
not equal $a != $b TRUE if $a is not equal to $b after type juggling.
not equal $a <> $b TRUE if $a is not equal to $b after type juggling.
Spaceship Operator $a <=> $b An integer less than, equal to, or greater than zero when $a is respectively less than, equal to, or greater than $b. Available as of PHP 7.
Null Coalesce Operator $a ?? $b ?? $c Returns the first operand from left to right that exists and not NULL. If nothing exists will return NULL. Available as of PHP 7.