It's called Nullable types
.
Which defines ?int
as either int
or null
.
Type declarations for parameters and return values can now be marked as nullable by prefixing the type name with a question mark. This signifies that as well as the specified type, NULL can be passed as an argument, or returned as a value, respectively.
Example :
function nullOrInt(?int $arg){
var_dump($arg);
}
nullOrInt(100);
nullOrInt(null);
function nullOrInt
will accept both null and int.
Ref: http://php.net/manual/en/migration71.new-features.php