darkfriend / php5-type
PHP5-helper for type data
Installs: 1 398
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3
This package is auto-updated.
Last update: 2024-11-08 19:37:00 UTC
README
composer require darkfriend/php5-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) "" );