3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class x { function __construct(){ $x=& $this; $x = new y; var_dump($this); } function foo(){ $this->bar(); } } class y{ function bar(){ echo "bar"; } } $b=new x; $b->__construct();
Output for 7.1.0
object(x)#1 (0) { } object(x)#1 (0) { }
Output for 5.0.0 - 7.0.14
object(y)#2 (0) { } object(y)#2 (0) { }
Output for 4.3.0 - 4.4.9
object(y)(0) { }