d
Amit DhamuSoftware Engineer
 

Valid PHP Types

11 minute read 00000 views

Valid types available for return and argument types

TypeDescriptionMinimum PHP Version
Class/interface nameThe parameter must be an instanceof the given class or interface name.PHP 5.0.0
selfThe parameter must be an instanceof the same class as the one the method is defined on. This can only be used on class and instance methods.PHP 5.0.0
arrayThe parameter must be an array.PHP 5.1.0
callableThe parameter must be a valid callable.PHP 5.4.0
boolThe parameter must be a boolean value.PHP 7.0.0
floatThe parameter must be a floating point number.PHP 7.0.0
intThe parameter must be an integer.PHP 7.0.0
stringThe parameter must be a string.PHP 7.0.0
iterableThe parameter must be either an array or an instanceof Traversable.PHP 7.1.0
objectThe parameter must be an object.PHP 7.2.0
voidThe function/method will not return anything.PHP 7.1.0