Task: you need to get a list (or number) of arguments from the function (outside the function).

Is there any function

int/array get_function_args(string $fname) 

which would return the number of arguments, or an array of function argument names? First I found func_ get_ args () , but this is not the function, since works inside the function.

If such a method does not exist, then a very beautiful solution of one problem disappears: (...

    1 answer 1

    Class ReflectionParameter not suitable?

    • Definitely a plus sign, I forgot about reflection, so I came up with such a shame: facepalm: define (WARNING, E_USER_NOTICE); $ counter = 0; $ x = function ($ a, $ b) {return 666;}; function myErrorHandler ($ errno, $ errstr, $ errfile, $ errline) {global $ counter; $ counter ++; }; set_error_handler ("myErrorHandler"); function funcParams ($ func) {global $ counter; $ func (); echo $ counter; }; funcParams ($ x); - ReinRaus
    • Bro, thank you. It looks like this is what you need ... - kanaris