<?php
trait Foo
{
public $hidden;
function __call($name, $arguments)
{
echo 'hello from overload';
}
function destruct()
{
unset($this);
}
}
class Bar
{
use Foo;
function hello()
{
echo 'hello from bar';
}
}
class Cheese
{
static function deleteMe($obj)
{
$obj->destruct();
}
}
$foo = new Bar();
Cheese::deleteMe($foo);
gc_collect_cycles();
$foo->hello();