3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tmp { function __destruct() { var_dump("destroying"); } } $tmp = new Tmp(); $fn = function () use ($tmp) { $tmp = 42; var_dump("closure executed"); }; var_dump("closure defined"); unset($tmp); var_dump("original var unset"); $fn();

preferences:
60.64 ms | 404 KiB | 5 Q