tebru / realtype
Get the real type from a string
Installs: 10 436
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3
Requires (Dev)
- phpunit/phpunit: ^4.0
- satooshi/php-coveralls: 0.6.1
- symfony/config: ~2.0
- symfony/console: ~2.0
- symfony/filesystem: ~2.3
- symfony/stopwatch: ~2.2
- symfony/yaml: ~2.0
README
Realtype
A PHP library that gets the real type from a string. Sometimes doubles, integers, or booleans will exist inside a string. This library determines what type it really is and returns that.
Installation
composer require tebru/realtype
Usage
\Tebru\Realtype\Realtype::get('2.2'); // returns 2.2
\Tebru\Realtype\Realtype::get('2.0'); // returns 2.0
\Tebru\Realtype\Realtype::get('2'); // returns 2
\Tebru\Realtype\Realtype::get('0'); // returns 0
\Tebru\Realtype\Realtype::get('true'); // returns true
\Tebru\Realtype\Realtype::get('false'); // returns false
\Tebru\Realtype\Realtype::get('string'); // returns 'string'
\Tebru\Realtype\Realtype::get(2.2); // returns 2.2