Logical operators apply a logic operation to its operands, returning a Boolean response.
The most used ones are ! (not), && (and), and || (or).
&& will return true only if both operands evaluate to true.
|| will return true if any or both of the operands are true.
! will return the negated value of the operand, that is, true if the operand is false or false if the operand is true.
<?php var_dump(true && true); // true var_dump(true && false); // false var_dump(true || false); // true var_dump(false || false); // false var_dump(!false); // true ?>/*from w ww . jav a 2 s .c o m*/