Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Boolean

A boolean is a value that is either true or false.

PHP’s boolean are constants. They may be prefixed by \, and are case-insensitive. They can’t be redefined in any namespace.

There are operators to convert any data to a boolean, and operators to combine boolean together. There are also bit operators, which process integers as a field of boolean.

Booleans have a related scalar type: bool. There is also a special false type.

<?php

    $a = True;
    $b = \FALSE;

?>

Documentation

See Also