1. Home
  2. Computing & Technology
  3. PHP / MySQL

Boolean Logic

By , About.com Guide

Definition: Boolean logic is a type of decision making utilized by computers to decide if a statement is true or false. There are four main boolean operators used to evaluate a statement as true or false. They are:

&& - true if both operands are true
|| - true if at least one operand is true
xor - true if ONLY one operand is true
! - true if a single operand is false

Examples:
A is True
B is True
C is False

A && B
This is asking for A and B to both be true, since they are both true, this expression is TRUE

A || C
This is asking for A or C to be true. Again this is a TRUE expression

A xor B
This is asking for A or B but not both, to be true. Since they are both true, this expression is FALSE

!A
This is asking for A to be false. Since A is true, this expression is FALSE

!C
This is asking for C to be false. Since C is false, this expression is TRUE

Explore PHP / MySQL
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Programing Glossary
  5. Boolean Operator - Boolean Algebra - Boolean Logic

©2009 About.com, a part of The New York Times Company.

All rights reserved.