- var_dump: documentation ( source)
<?php
class Box{
protected $type, $ref;
function __construct($type, &$var){
$this->type = $type;
$this->ref = &$var;
}
function __set($name, $data){
$this->ref = [$this->type, "__box"]($data);
}
}
function §($type, &$var){
return new Box($type, $var);
}
// ---------
class UString{
function __construct($data){
$this->data = $data;
}
static function __box($data){
if(is_string($data))
return new static($data);
throw new Error;
}
} const UString = UString::CLASS;
// ---------
§(UString, $bar)->set = "ùnìcòdè";
var_dump($bar);