How to obtain the number of parameters of a function itself? & Lt ;? Php & nbsp; function & nbsp; hello ($ param1, $ param2 ,...) {echo & nbsp; function & nbsp; name & nbsp; is :. & nbsp ;__ FUNCTION __; & nbsp; get & nbsp; function & nbsp; itself & nbsp how many parameters does a FUNCTION have?
Function hello ($ param1, $ param2 ,...){
Echo 'function name is: '. _ function __; // get FUNCTION itself name
// How to get how many parameters in these function,
Echo'
Has? Parameters ';
}
Hello ();
I want to automatically obtain the name of the custom function and how many parameters are passed in. how can I get it?
------ Solution --------------------
Function hello (){
Echo 'function name is: '. _ function __; // get FUNCTION itself name
// How to get how many parameters in these function,
Echo'
Has '. func_num_args ().' parameters
';
$ Params = func_get_args ();
Foreach ($ params as $ param ){
Echo $ param .'
';
}
}
Hello (1, 2, 3 );