PHP Logical Operators

PHP provides three logical operators when we test more than one condition to make decisions. These are: && (meaning logical AND), || (meaning logical OR) and ! (meaning logical NOT).

OperatorDescription
&&And operator performs logical conjunction on two expressions
(if both expressions evaluate to True, result is True. If either expression evaluates to False, the result is False)
||Or operator performs a logical disjunction on two expressions
(if either or both expressions evaluate to True, the result is True).
!Not operator performs logical negation on an expression.

Courses
Subscribe Updates via Email

Join 49,000+ W3schools lovers and get all the latest tutorials, programs, algorithms in your inbox.