Logic Operators in PHP : Logical Operators « Operator « PHP






Logic Operators in PHP

 
Operator                 Action
 
$foo and $bar            TRue if $foo and $bar are TRue
 
$foo or $bar             true if $foo or $bar is true
 
$foo xor $bar            true if and only if $foo or $bar is true (only one or the other)
 
!$foo                    true if $foo is not true
 
$foo && $bar             TRue if $foo and $bar are true
 
$foo || $bar             true if $foo or $bar is true
  
  








Related examples in the same category

1.Logical Operators in Order of Precedence
2.Use the boolean compare operators
3.Greater than
4.Less than
5.Greate and equal
6.Less than and equal
7.Not equal: !=
8.Logical Operators
9.Or operator
10.Leap Year Determination
11.Negation operator
12.The not-equals operator
13.Relational Operators summary table
14.Relational Operators in action