darkfriend / php7-type
There is no license information available for the latest version (1.0.0) of this package.
PHP7-helper for type data
1.0.0
2019-12-21 12:26 UTC
Requires
- php: >=7.0
This package is auto-updated.
Last update: 2024-11-08 11:42:27 UTC
README
composer require darkfriend/php7-type
TypeHelper::toStrictType($value)
- return $value to strict type
Example
use \darkfriend\helpers\TypeHelper; var_dump( TypeHelper::toStrict('false'), // bool(false) TypeHelper::toStrict(null), // NULL TypeHelper::toStrict(0), // int(0) TypeHelper::toStrict('0'), // int(0) TypeHelper::toStrict('1'), // int(1) TypeHelper::toStrict(1), // int(1) TypeHelper::toStrict('1.1'), // float(1.1) TypeHelper::toStrict(1.1), // float(1.1) TypeHelper::toStrict(true), // bool(true) TypeHelper::toStrict(false), // bool(false) TypeHelper::toStrict('my string'), // string(9) "my string" TypeHelper::toStrict('') // string(0) "" );