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
See type-juggling for general information about converting.
When converting to boolean, the following values are considered FALSE:
the boolean FALSE
the integer 0 (zero)
the float 0.0 (zero)
an array with zero elements
an object with zero elements
the special value NULL
Warning |
-1 is considered TRUE! |