Table of PHP Logical Operators
Operator | Name | Use | Result |
---|---|---|---|
! | NOT | !$b | Returns true if $b is false and vice versa |
&& | AND | $a && $b | Returns true if both $a and $b are true; otherwise false |
|| | OR | $a and $b | Returns true if either $a or $b or both are true; otherwise false |
and | AND | $a and $b | Same as &&, but with lower precedence |
or | OR | $a or $b | Same as ||, but with lower precedence |
xor | XOR | $a x or $b | Returns true if either $a or $b is true, and false if they are both true or both false |