PHP Logical Operators

Table of PHP Logical Operators

OperatorNameUseResult
!NOT!$bReturns true if $b is false and vice versa
&&AND$a && $bReturns true if both $a and $b are true;
otherwise false
||OR$a and $bReturns true if either $a or $b or both are
true; otherwise false
andAND$a and $bSame as &&, but with lower precedence
orOR$a or $bSame as ||, but with lower precedence
xorXOR$a x or $bReturns true if either $a or $b is true, and false
if they are both true or both false
PHP Logical Operators

Leave a Comment