3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = function($b) { print "$b\n"; }; $a('lulz'); $b['lulz'] = function($b) { print "$b\n"; }; $b['lulz']('more lulz'); $c = new stdclass(); $c->func = function($b) { print "$b\n"; }; $c->func('hahaha nope'); class D { public $func = function($b) { print "$b\n"; }; } $d = new D(); $d->func('asdf);
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected 'function' (T_FUNCTION) in /in/ZqlkV on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_FUNCTION in /in/ZqlkV on line 14
Process exited with code 255.

preferences:
180.47 ms | 1386 KiB | 62 Q