<?php
final class string
{
private $holder = null;
public function __construct($string)
{
$this->holder = (string)$string;
}
public function __toString()
{
return $this->holder;
}
public function __call($name, $args)
{
return call_user_func_array($name, array_merge([$this->holder], $args));
}
}
var_dump(
strlen(new string('foo')),
(new string('bar'))->strlen()
);