Logical Operators¶
Logical operators applies four logical functions to booleans.
andand&&orand||xor, no symbolic version forxor!, no letter version fornot
The logical operators are either symbolic or letter. Be aware that the symbolic operators have a higher precedence than the letter one, in particular in regards to comparisons.
The logical operators work on various types, and output booleans. They are different from the bitwise operators, which work on the value as a bit level, not as a whole.
<?php
if ($a == $b) {
print "a and b are equal";
}
?>
See also Operator Precedence.
Related : Bitwise Operators, Not Operator, And Operator, Bitshift Operators, False, True, Letter Logical Bug, Pipe Operator