3v4l.org

run code in 300+ 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.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
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:
51.03 ms | 406 KiB | 5 Q