3v4l.org

run code in 300+ PHP versions simultaneously
<?php function baz($a){ unset($a); echo "2\n"; }; echo "1\n"; baz(new class(){ function __destruct(){ echo "destruct\n"; }); echo "3\n";
Output for 7.0.0 - 7.0.6
Parse error: syntax error, unexpected ')', expecting function (T_FUNCTION) in /in/98uOv on line 1
Process exited with code 255.
Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.21
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/98uOv on line 1
Process exited with code 255.

preferences:
147.21 ms | 1347 KiB | 6 Q