3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { private $b; public function __construct() { $this->b = new B($this); } } class B { private $a; public function __construct(A $a) { $this->a = $a; } } $a=new A(); var_dump($a); var_export($a); print_r($a);
Output for 5.4.7 - 7.1.0
object(A)#1 (1) { ["b":"A":private]=> object(B)#2 (1) { ["a":"B":private]=> *RECURSION* } } Warning: var_export does not handle circular references in /in/P35SH on line 24 A::__set_state(array( 'b' => B::__set_state(array( 'a' => NULL, )), ))A Object ( [b:A:private] => B Object ( [a:B:private] => A Object *RECURSION* ) )
Output for 5.3.3 - 5.4.6
object(A)#1 (1) { ["b":"A":private]=> object(B)#2 (1) { ["a":"B":private]=> *RECURSION* } } Fatal error: Nesting level too deep - recursive dependency? in /in/P35SH on line 24
Process exited with code 255.
Output for 5.3.0 - 5.3.2
object(A)#1 (1) { ["b":"A":private]=> object(B)#2 (1) { ["a":"B":private]=> object(A)#1 (1) { ["b":"A":private]=> object(B)#2 (1) { ["a":"B":private]=> *RECURSION* } } } } A::__set_state(array( 'b' => B::__set_state(array( 'a' => A::__set_state(array( 'b' => B::__set_state(array( 'a' => A::__set_state(array( 'b' => B::__set_state(array( 'a' => A::__set_state(array( Fatal error: Nesting level too deep - recursive dependency? in /in/P35SH on line 24
Process exited with code 255.
Output for 5.2.14 - 5.2.17
object(A)#1 (1) { ["b:private"]=> object(B)#2 (1) { ["a:private"]=> *RECURSION* } } Fatal error: Nesting level too deep - recursive dependency? in /in/P35SH on line 24
Process exited with code 255.
Output for 5.1.0 - 5.2.13
object(A)#1 (1) { ["b:private"]=> object(B)#2 (1) { ["a:private"]=> object(A)#1 (1) { ["b:private"]=> object(B)#2 (1) { ["a:private"]=> *RECURSION* } } } } A::__set_state(array( 'b' => B::__set_state(array( 'a' => A::__set_state(array( 'b' => B::__set_state(array( 'a' => A::__set_state(array( 'b' => B::__set_state(array( 'a' => A::__set_state(array( Fatal error: Nesting level too deep - recursive dependency? in /in/P35SH on line 24
Process exited with code 255.
Output for 5.0.0 - 5.0.5
object(A)#1 (1) { ["b:private"]=> object(B)#2 (1) { ["a:private"]=> object(A)#1 (1) { ["b:private"]=> object(B)#2 (1) { ["a:private"]=> *RECURSION* } } } } class A { private $b = class B { private $a = class A { private $b = class B { private $a = class A { private $b = class B { private $a = class A { Fatal error: Nesting level too deep - recursive dependency? in /in/P35SH on line 24
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/P35SH on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/P35SH on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/P35SH on line 4
Process exited with code 255.