PrimitiveType

Boolean

A Boolean variable is one that can be either true or false. Sometimes this is represented as on or off, or, 1 or 0.

In a program, Boolean expressions are tested to decide what course of action to take. They are usually found in if statements and loops. For example, the following is a PHP snippet in which $isOK is a Boolean value:

($isOK)
{
    // do something
}


If $isOK evaluates to true, the statements inside the curly braces will be executed. If it evaluates to false, the statements within the curly braces will not be reached.

See ALL glossary entries