3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A extends SplObjectStorage { protected $b; protected $a = [ 'date' => null, ]; public function __construct(B $b) { $this->b = $b; $this->a = [ 'date' => '123', ]; } public function getA() { return $this->a; } } class B{} $serialized = serialize(new A(new B)); $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); var_Dump($obj['date']);

preferences:
115.9 ms | 402 KiB | 5 Q