Special Types¶
PHP defines some special types.
mixed: any typevoid: no returned valuecallable: may be used as a callbackiterable: may be used withforeach(), including arraynever: never returnsobject: object of any classparent: any of the parent class of the current class, excluding itself: the current classstatic: the current called class
Other special types are the scalar types.
<?php
function foo(iterable $i) : never {
foreach ($i as $j) {
echo $j;
}
die();
}
?>
See also An Exhaustive Guide to Understanding and Using PHP Data Types.
Related : Type System, Type System, Mixed, Void, Callables, Iterable, Never Type, Object, parent, static, Self
Added in PHP 7.0