--TEST-- func_get_args() tests --FILE-- getMessage(), "\n"; } test3(1,2); call_user_func("test1"); try { call_user_func("test3", 1); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } call_user_func("test3", 1, 2); class test { static function test1($a) { var_dump(func_get_args()); } } test::test1(1); try { var_dump(func_get_args()); } catch (\Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- array(0) { } array(1) { [0]=> int(10) } array(1) { [0]=> int(1) } ArgumentCountError: Too few arguments to function test2(), 0 passed in %s on line %d and exactly 1 expected array(2) { [0]=> int(1) [1]=> int(2) } array(0) { } ArgumentCountError: Too few arguments to function test3(), 1 passed in %s on line %d and exactly 2 expected array(2) { [0]=> int(1) [1]=> int(2) } array(1) { [0]=> int(1) } Error: func_get_args() cannot be called from the global scope