3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php namespace Test; class Foo { public function bar(\callable $a) { $a(); } public function hello() { echo 'World' . PHP_EOL; } public function test($a) { echo 'Hello' . PHP_EOL; } } $foo = new Foo(); echo is_callable(array($foo, 'hello')); $foo->bar(array($foo, 'hello'));
Output for 5.4.0 - 5.4.23
Parse error: syntax error, unexpected 'callable' (T_CALLABLE), expecting identifier (T_STRING) in /in/DGmOG on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.28
1 Catchable fatal error: Argument 1 passed to Test\Foo::bar() must be an instance of callable, array given, called in /in/DGmOG on line 20 and defined in /in/DGmOG on line 6
Process exited with code 255.