use TypedPHP\Functions\TypeFunctions;
TypeFunctions\getType(1.5); // number
TypeFunctions\isBoolean(false); // true
TypeFunctions\isBoolean("false"); // false
Functions:
isNumber
isBoolean
isNull
isObject
isFunction
isExpression
isString
isResource
getType
Caveats:
isExpression
will return false ifisString
returns true.isFunction
will return false ifisObject
returns true.getType
will return unknown if the argument is not matched by any of theis*
functions.
❯ composer require "typedphp/type-functions:*"
❯ composer create-project "typedphp/type-functions:*" .
❯ vendor/bin/phpunit