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 f { public function f($b) { print "$b\n"; } } $f = new f(); $f->f = function($b) { print "test $b\n"; } $f->f();
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected '$f' (T_VARIABLE) in /in/8qPDd on line 23
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/8qPDd on line 23
Process exited with code 255.

preferences:
184.44 ms | 1395 KiB | 62 Q