3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 g($b) { print "$b\n"; } } $f = new f(); $f->g("test"); $f->g = function($b) { print "test $b\n"; } $f->g("test");
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected '$f' (T_VARIABLE) in /in/QvNS4 on line 25
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/QvNS4 on line 25
Process exited with code 255.