1. Go to this page and download the library: Download ctw/ctw-cast 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/ */
ctw / ctw-cast example snippets
(int) "42abc"; // 42 (silently ignores "abc")
(int) []; // 0 (arrays become 0 or 1)
(bool) "false"; // true (non-empty string)
(float) "invalid"; // 0.0 (no error)
use Ctw\Cast\Cast;
$int = Cast::toInt($userInput); // 0 if not castable
$str = Cast::toString($userInput); // '' if not castable
$bool = Cast::toBool($userInput); // false if not castable
$float = Cast::toFloat($userInput); // 0.0 if not castable
$arr = Cast::toArray($userInput); // [] if not castable
$json = Cast::toJson($userInput); // '{}' if not castable
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.