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

Literal Types

Literal types are types which not only check the type of a value but also the value itself. PHP has support for two literal types: false as of PHP 8.0.0, and true as of PHP 8.2.0.

<?php

    // bool is a type
    // false is a literal type : a bool, which value is false
    function trumpet(bool $a) : false {
        return false;
    }

?>

Documentation

See Also