3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class a { protected $a = 10; protected $c;} class b { protected $b; public function setA($a){$this->b = $a;return $this;}} var_dump(unserialize(serialize((new b)->setA(new a)), [true]));
based on hcj5A
Output for 7.0.0 - 7.2.0
object(b)#1 (1) { ["b":protected]=> object(a)#2 (2) { ["a":protected]=> int(10) ["c":protected]=> NULL } }
Output for 5.4.10 - 5.6.28
Warning: unserialize() expects exactly 1 parameter, 2 given in /in/G1dIO on line 7 bool(false)
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/G1dIO on line 7
Process exited with code 255.