# Logical Operators : Logical Operators « Operator « PHP

Home
PHP
 1 Chart 2 Class 3 Components 4 Cookie Session 5 Data Structure 6 Data Type 7 Date 8 Design Patterns 9 Development 10 DNS 11 Email 12 File Directory 13 Form 14 Functions 15 Graphics Image 16 HTML 17 Language Basics 18 Login Authentication 19 Math 20 MySQL Database 21 Network 22 Operator 23 PDF 24 Reflection 25 Statement 26 String 27 Utility Function 28 Web Services SOAP WSDL 29 XML
 PHP » Operator » Logical Operators
Logical Operators
 ```  Operator     Name     Returns True if...                               Example              Result   ||           Or       Left or right is true                            true || false        true   or           Or       Left or right is true                            true || false        true   xor          Xor      Left or right is true but not both               true xor true        false   &&           And      Left and right are true                          true && false        false   and          And      Left and right are true                          true && false        false   !            Not      The single operand is not true                   ! true               false   ";   \$result .= "OR   - 1:\$test4 2:\$test5 3:\$test6
";   \$result .= "XOR - 1:\$test7 2:\$test8 3:\$test9
";   \$result .= "NOT - 1:\$test10 2:\$test11";     echo( \$result );  ?> = 13) && (\$age < 65)) {    print "too old for a kid's discount and too young for the senior's discount."; } \$meal = 'breakfast'; if ((\$meal == 'breakfast') || (\$dessert == 'souffle')) {    print "Time to eat some eggs."; } ?>      ```
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 Logic Operators in PHP 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