- var_dump: documentation ( source)
- unserialize: documentation ( source)
- serialize: documentation ( source)
<?php
class A extends SplObjectStorage
{
protected $a = null;
public function __construct()
{
$this->a = '123';
}
public function getA()
{
return $this->a;
}
}
$serialized = serialize(new A());
$obj = unserialize($serialized);
$reader = function & ($object, $property) {
$value = & \Closure::bind(function & () use ($property) {
return $this->$property;
}, $object, $object)->__invoke();
return $value;
};
$test3 = & $reader($obj, 'a');
echo "Result from Getter\n";
var_dump($obj->getA());
echo "Result from Reflection\n";
var_Dump($test3);
echo "This is the deserialized Object\n";
var_Dump($obj);