Booleans

This is the simpelest type. A boolean expresses a truth value. It can be either TRUE or FALSE.

You can use the special case-insensitive constants 'TRUE' and 'FALSE' to specify a boolean value. Usually you use some kind of operator which returns a boolean value, and then pass it on to a control structure.

Note: The boolean-type was introduced in PHP 4

Converting to boolean

See type-juggling for general information about converting.

When converting to boolean, the following values are considered FALSE:

Every other value is considered TRUE (including any resource).

Warning

-1 is considered TRUE!