3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class ClassSave { function __destruct(){ global $test; $test = $this; echo "Destruct\r\n"; } } echo "1: "; new ClassSave(); echo "2: "; var_dump($test); $test = null; unset($test); echo "End\r\n";
Output for 5.0.0 - 7.1.0
1: Destruct 2: object(ClassSave)#1 (0) { } End
Output for 4.3.0 - 4.4.9
1: 2: Notice: Undefined variable: test in /in/r5pZR on line 13 NULL End