https://github.com/darkfriend/php5-type
https://github.com/darkfriend/php5-type
php php5 strict-types type-helper
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/darkfriend/php5-type
- Owner: darkfriend
- Created: 2019-12-20T20:58:09.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-08T08:35:56.000Z (about 6 years ago)
- Last Synced: 2025-05-26T19:06:42.710Z (about 1 year ago)
- Topics: php, php5, strict-types, type-helper
- Language: PHP
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TypeHelper
``composer require darkfriend/php5-type``
* ```TypeHelper::toStrictType($value)``` - return $value to strict type
## Example
```php
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) ""
);
```