PHP obtains the number of function parameters externally. FunctionWar ($ a, $ B, $ c) {$ nfunc_num_args (); echo $ n;} War (1, 2, 3); func_num_args () this function can only obtain the number of parameters in the function, but cannot be obtained outside the function. what is the function War ($ a, $ B, $ c) method)
{
$ N = func_num_args ();
Echo $ n;
}
War (1, 2, 3 );
Func_num_args (): This function can only obtain the number of parameters in the function, but cannot be obtained outside the function. Is there any way to obtain the number of function parameters externally?
--------------------------------------------------------------------------------
Func_num_args () returns the number of parameters passed to the host function.
--------------------------------------------------------------------------------
Func_num_args () gets the number of actually passed parameters, rather than the predefined number, so there should be no "external get" statement.
PHP code
Function War ()
{
$ N = func_num_args ();
Echo $ n;
}
War (1, 2, 3 );
War (1, 2, 3, 4 );
War (1, 2 );
--------------------------------------------------------------------------------
We can use comments of User-defined functions and reflection to obtain the value from "external retrieval ".
PHP code
/**
* A user-defined function
*
* @ Param string $
* @ Param string $ B
* @ Param string $ c
*/
Function War ($ a, $ B, $ c ){}
/**
* A user-defined function 2
*
* @ Param s ......
Http://www.bkjia.com/PHPjc/371715.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/371715.htmlTechArticlefunction War ($ a, $ B, $ c) {$ n = func_num_args (); echo $ n;} War (, 3); func_num_args () this function can only obtain the number of parameters in the function, but cannot be obtained outside the function. what is the method...