3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $x = new stdClass; $y = new stdClass; $y->foo = $x->foo = new stdClass; $x->foo->bar = 2; var_dump($y); $xSer = serialize($x); $ySer = serialize($y); $x = unserialize($xSer); $y = unserialize($ySer); $x->foo->bar = 5; var_dump($y);
Output for 5.0.0 - 5.6.28, 7.0.0 - 7.1.0
object(stdClass)#2 (1) { ["foo"]=> object(stdClass)#3 (1) { ["bar"]=> int(2) } } object(stdClass)#1 (1) { ["foo"]=> object(stdClass)#6 (1) { ["bar"]=> int(2) } }
Output for hhvm-3.10.0 - 3.12.0
object(stdClass)#2 (1) { ["foo"]=> object(stdClass)#3 (1) { ["bar"]=> int(2) } } object(stdClass)#6 (1) { ["foo"]=> object(stdClass)#7 (1) { ["bar"]=> int(2) } }
Output for 4.3.0 - 4.4.9
object(stdClass)(1) { ["foo"]=> object(stdClass)(0) { } } object(stdClass)(1) { ["foo"]=> object(stdClass)(0) { } }