3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $Object = (object)array( 'a' => 1, 'b' => &$Object, ); print_r($Object); $Array = array( 'a' => 1, 'b' => &$Array, ); print_r($Array); $Array = unserialize(serialize($Array)); $Object = unserialize(serialize($Object)); $Object->b->a = 2; print_r($Object); $Array['b']['a'] = 2; print_r($Array);
Output for 7.0.0 - 7.1.0
stdClass Object ( [a] => 1 [b] => stdClass Object *RECURSION* ) Array ( [a] => 1 [b] => Array *RECURSION* ) stdClass Object ( [a] => 2 [b] => stdClass Object *RECURSION* ) Array ( [a] => 1 [b] => Array ( [a] => 2 [b] => Array *RECURSION* ) )
Output for 5.1.0 - 5.6.28
stdClass Object ( [a] => 1 [b] => stdClass Object *RECURSION* ) Array ( [a] => 1 [b] => Array ( [a] => 1 [b] => Array *RECURSION* ) ) stdClass Object ( [a] => 2 [b] => stdClass Object *RECURSION* ) Array ( [a] => 1 [b] => Array ( [a] => 2 [b] => Array *RECURSION* ) )
Output for 5.0.0 - 5.0.5
stdClass Object ( [a] => 1 [b] => stdClass Object *RECURSION* ) Array ( [a] => 1 [b] => Array ( [a] => 1 [b] => Array *RECURSION* ) )
Process exited with code 139.
Output for 4.3.0 - 4.4.9
stdClass Object ( [a] => 1 [b] => stdClass Object ( [a] => 1 [b] => *RECURSION* ) ) Array ( [a] => 1 [b] => Array ( [a] => 1 [b] => Array *RECURSION* ) ) stdClass Object ( [a] => 1 [b] => stdClass Object ( [a] => 2 [b] => *RECURSION* ) ) Array ( [a] => 1 [b] => Array ( [a] => 2 [b] => Array *RECURSION* ) )