3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static function bar() { $args = func_get_args(); var_dump($args); } } $method = array('Foo', 'bar'); $args = 123; call_user_func($method, $args) // NOT WORKING it just don't goes in the methods call call_user_func($method, 123) // NOT WORKING it just don't goes in the methods call call_user_func($method, (int) 123) // WORKING !! $method = array('Foo', 'bar'); $args = array(123, 456); call_user_func_array($method, $args) // NOT WORKING call_user_func_array($method, (array) $args) // NOT WORKING it just don't goes in the methods call call_user_func_array($method, array((array) $args)) // WORKING !!
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected 'call_user_func' (T_STRING) in /in/cuSd0 on line 19
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING in /in/cuSd0 on line 19
Process exited with code 255.

preferences:
169.57 ms | 1399 KiB | 53 Q