granam/string

轻量级字符串包装器

安装次数: 23,811

依赖者: 25

建议者: 0

安全: 0

星标: 2

关注者: 2

分支: 0

公开问题: 0

类型:项目

4.2.2 2023-10-20 07:40 UTC

README

<?php
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());
}