PHP code example of jrfnl / php-cast-to-type
1. Go to this page and download the library: Download jrfnl/php-cast-to-type 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/ */
jrfnl / php-cast-to-type example snippets
$value = 'example';
$value = CastToType::_bool( $value ); // null
$value = 'true';
$value = CastToType::_bool( $value ); // true
$value = '123';
$value = CastToType::_int( $value ); // 123
$value = array( '123' );
$value = CastToType::_int( $value ); // null
$value = CastToType::_int( $value, $array2null = false ); // array( 123 )