3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = null; class A { public function __construct() { global $a; $a = $this; throw new Exception("what?"); } } try { $x = new A(); } catch(Exception $e) { } var_dump($a);

preferences:
36.76 ms | 402 KiB | 5 Q