PHP code example of ducks-project / spl-types
1. Go to this page and download the library: Download ducks-project/spl-types 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/ */
ducks-project / spl-types example snippets
// With Spl Extension.
$test = 10;
$value = new \SplInt($test);
if ($test == $value) {
echo 'OK';
}
// With Spl Plyfill.
$test = 10;
$string = new \SplInt($test);
if ($test === $string) { // Cast Error.
echo 'OK';
}
$bool = new \SplBool(false);
if ($bool) {
echo 'This is true'; // Object is not null so it pass test...
}