Nullable

Nullable is the name of the NULL value, when used as a type. Until PHP 8.0, it was marked as a question mark with types, and since PHP 8.0, it is also marked with its own name, as an union type.

<?php

function foo(?A $a) : null | B {
    // code
}

?>

Documentation

See also Dealing with null

Related : Null, Type System

Added in PHP 7.1