3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo(Callable $a) { echo "called\n"; } class A { private function foo1() {} public function foo2() {} } foo([new A, 'foo2']); foo([new A, 'foo1']);
based on 9Q21r
Output for 7.0.0 - 7.2.0
called Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be callable, array given, called in /in/AeZXs on line 15 and defined in /in/AeZXs:3 Stack trace: #0 /in/AeZXs(15): foo(Array) #1 {main} thrown in /in/AeZXs on line 3
Process exited with code 255.
Output for 5.4.9 - 5.6.28
called Catchable fatal error: Argument 1 passed to foo() must be callable, array given, called in /in/AeZXs on line 15 and defined in /in/AeZXs on line 3
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/AeZXs on line 13
Process exited with code 255.