3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function test() { echo 'test'; } } function changeMe(&$obj) { $obj = function(){ $test = function(){echo 'im a test'}; }; } $foo = new Foo(); var_dump($foo); changeMe($foo); $foo->test();
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.26
Parse error: syntax error, unexpected '}', expecting ',' or ';' in /in/g3Eup on line 14
Process exited with code 255.

preferences:
181.84 ms | 1395 KiB | 63 Q