weregod
unserializer
PHP:
class Foo
{
protected static $uidStatic = 0;
protected $uid;
public function __construct()
{
++self::$uidStatic;
$this->uid = self::$uidStatic;
echo sprintf("%s: %d\n", __METHOD__, $this->uid);
}
public function __destruct()
{
echo sprintf("%s: %d\n", __METHOD__, $this->uid);
}
}
$foo = new Foo;
unset($foo);
$foo = new Foo;
$foo = new Foo;
Код:
Foo::__construct: 1
Foo::__destruct: 1
Foo::__construct: 2
Foo::__construct: 3
Foo::__destruct: 2
Foo::__destruct: 3
Код:
...
Foo::__construct: 2
Foo::__destruct: 2
Foo::__construct: 3
Foo::__destruct: 3