3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public function __destruct() { echo new Exception(); } } function bar1() { $a = new Foo; $a = null; } function bar2() { $a = new Foo; $b = $a; $a = null; } bar1(); bar2();
Output for 8.1.32 - 8.1.34, 8.2.0 - 8.2.32, 8.3.0 - 8.3.32, 8.4.1 - 8.4.24, 8.5.0 - 8.5.9
Exception in /in/VP5IJ:5 Stack trace: #0 /in/VP5IJ(11): Foo->__destruct() #1 /in/VP5IJ(20): bar1() #2 {main}Exception in /in/VP5IJ:5 Stack trace: #0 /in/VP5IJ(21): Foo->__destruct() #1 {main}

preferences:
66.92 ms | 909 KiB | 4 Q