3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CbMan { public function fn(callable $cb) { echo $cb(); } } class Pippo { public function yah() { return "hello world"; } } $methods = ['yah']; $aa = function($instance, $methods) { return call_user_func($instance, $methods); } $cb = $aa($instance, $methods); $cbman = new CbMan(); $cbman->fn($cb);
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.30, 5.6.8 - 5.6.14
Parse error: syntax error, unexpected '$cb' (T_VARIABLE) in /in/eL4Pc on line 23
Process exited with code 255.

preferences:
187.25 ms | 1395 KiB | 66 Q