3v4l.org

run code in 300+ PHP versions simultaneously
<?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;

preferences:
45.31 ms | 402 KiB | 5 Q