3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $foo = new \StdClass; $bar = new \StdClass; $foo->bar = $bar; $bar->foo = $foo; $vars = array('foo' => $foo, 'bar' => $bar); var_dump($vars); var_dump(serialize($vars));
Output for 5.3.3 - 7.1.0
array(2) { ["foo"]=> object(stdClass)#1 (1) { ["bar"]=> object(stdClass)#2 (1) { ["foo"]=> *RECURSION* } } ["bar"]=> object(stdClass)#2 (1) { ["foo"]=> object(stdClass)#1 (1) { ["bar"]=> *RECURSION* } } } string(92) "a:2:{s:3:"foo";O:8:"stdClass":1:{s:3:"bar";O:8:"stdClass":1:{s:3:"foo";r:2;}}s:3:"bar";r:3;}"
Output for 5.3.0 - 5.3.2
array(2) { ["foo"]=> object(stdClass)#1 (1) { ["bar"]=> object(stdClass)#2 (1) { ["foo"]=> object(stdClass)#1 (1) { ["bar"]=> object(stdClass)#2 (1) { ["foo"]=> *RECURSION* } } } } ["bar"]=> object(stdClass)#2 (1) { ["foo"]=> object(stdClass)#1 (1) { ["bar"]=> object(stdClass)#2 (1) { ["foo"]=> object(stdClass)#1 (1) { ["bar"]=> *RECURSION* } } } } } string(92) "a:2:{s:3:"foo";O:8:"stdClass":1:{s:3:"bar";O:8:"stdClass":1:{s:3:"foo";r:2;}}s:3:"bar";r:3;}"
Output for 5.2.14 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/pqYpr on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/pqYpr on line 3 array(2) { ["foo"]=> object(stdClass)#1 (1) { ["bar"]=> object(stdClass)#2 (1) { ["foo"]=> *RECURSION* } } ["bar"]=> object(stdClass)#2 (1) { ["foo"]=> object(stdClass)#1 (1) { ["bar"]=> *RECURSION* } } } string(92) "a:2:{s:3:"foo";O:8:"stdClass":1:{s:3:"bar";O:8:"stdClass":1:{s:3:"foo";r:2;}}s:3:"bar";r:3;}"
Output for 5.0.0 - 5.2.13
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/pqYpr on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/pqYpr on line 3 array(2) { ["foo"]=> object(stdClass)#1 (1) { ["bar"]=> object(stdClass)#2 (1) { ["foo"]=> object(stdClass)#1 (1) { ["bar"]=> object(stdClass)#2 (1) { ["foo"]=> *RECURSION* } } } } ["bar"]=> object(stdClass)#2 (1) { ["foo"]=> object(stdClass)#1 (1) { ["bar"]=> object(stdClass)#2 (1) { ["foo"]=> object(stdClass)#1 (1) { ["bar"]=> *RECURSION* } } } } } string(92) "a:2:{s:3:"foo";O:8:"stdClass":1:{s:3:"bar";O:8:"stdClass":1:{s:3:"foo";r:2;}}s:3:"bar";r:3;}"
Output for 4.3.10 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/pqYpr on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/pqYpr on line 3 array(2) { ["foo"]=> object(stdClass)(1) { ["bar"]=> object(stdClass)(0) { } } ["bar"]=> object(stdClass)(1) { ["foo"]=> object(stdClass)(1) { ["bar"]=> object(stdClass)(0) { } } } } string(107) "a:2:{s:3:"foo";O:8:"stdClass":1:{s:3:"bar";O:8:"stdClass":0:{}}s:3:"bar";O:8:"stdClass":1:{s:3:"foo";r:2;}}"
Output for 4.3.0 - 4.3.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/pqYpr on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/pqYpr on line 3 array(2) { ["foo"]=> object(stdClass)(1) { ["bar"]=> object(stdClass)(0) { } } ["bar"]=> object(stdClass)(1) { ["foo"]=> object(stdClass)(1) { ["bar"]=> object(stdClass)(0) { } } } } string(151) "a:2:{s:3:"foo";O:8:"stdClass":1:{s:3:"bar";O:8:"stdClass":0:{}}s:3:"bar";O:8:"stdClass":1:{s:3:"foo";O:8:"stdClass":1:{s:3:"bar";O:8:"stdClass":0:{}}}}"