3v4l.org

run code in 300+ PHP versions simultaneously
<?php $f = function(){ static $run = 0; if ($run) { throw new Exception("I've already been run!"); } $run = 1; echo "I'm running\n"; } $f(); $f();
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected '$f' (T_VARIABLE) in /in/bXDRs on line 13
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/bXDRs on line 13
Process exited with code 255.

preferences:
182.02 ms | 1386 KiB | 64 Q