Logical Operators¶
Logical operators applies four logical functions to booleans.
and
and&&
or
and||
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 vis-à-vis 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