3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function method () { return function () { var_dump(__FUNCTION__, __METHOD__); }; } } $closure = (new Foo())->method(); $closure(); namespace InNamespace; class Foo { public function method () { return function () { var_dump(__FUNCTION__, __METHOD__); }; } } $closure = (new Foo())->method(); $closure();
Output for 5.4.0 - 5.4.30
Fatal error: Namespace declaration statement has to be the very first statement in the script in /in/KYbTI on line 13
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/KYbTI on line 10
Process exited with code 255.

preferences:
182.52 ms | 1395 KiB | 67 Q