PHP Manual
Prev | Chapter 10. Operators | Next

# Logical Operators

Table 10-5. Logical Operators

example | name | result
--- | --- | ---
$a and $b | And | True if both $a and $b are true.
$a or $b | Or | True if either $a or $b is true.
$a xor $b | Or | True if either $a or $b is true, but not both.
! $a | Not | True if $a is not true.
$a && $b | And | True if both $a and $b are true.
$a || $b | Or | True if either $a or $b is true.

The reason for the two different variations of "and" and "or" operators is that they operate at different precedences. (See Operator Precedence.)

Prev | Home | Next
Incrementing/Decrementing Operators | Up | Operator Precedence