PHP code example of granam / string
1. Go to this page and download the library: Download granam/string 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/ */
granam / string example snippets
use Granam\String\StringObject;
use Granam\String\Exceptions\WrongParameterType;
$string = new StringObject(12345.678);
echo $string; // string '12345.678'
try {
new StringObject(fopen('foo', 'rb'));
} catch (WrongParameterType $stringException) {
// Expected scalar or object with \_\_toString method on strict mode, got resource.
die('Something get wrong: ' . $stringException->getMessage());
}