PHP code example of anderswelt / stringtotype
1. Go to this page and download the library: Download anderswelt/stringtotype library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
anderswelt / stringtotype example snippets
php
use StringToType\StringToType
$stringWhichisReallyFloat = "123.123";
$stringWhichisReallyInt = "123";
$stringWhichisReallyBool = "true";
$stringWhichLooksLikeButIsntFloat = "0123.23";
$float = StringToType::convert($stringWhichisReallyFloat);
$int = StringToType::convert($stringWhichisReallyInt);
$bool = StringToType::convert($stringWhichisReallyBool);
$string = StringToType::convert($stringWhichLooksLikeButIsntFloat);