3v4l.org

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

preferences:
45.46 ms | 402 KiB | 5 Q