This article will explain the function parsing commonly used in PHP function processing.
func_get_arg-returns an item of a parameter list
func_get_args-returns an array containing a list of function arguments
func_num_args-returns the number of arguments passed to the function
call_user_func-call the first parameter as a callback function
Call_user_func_array-invokes the callback function and takes an array parameter as the parameter of the callback function
Forward_static_call_array-call a static method and pass the arguments as array
Forward_static_call-calls a static method and passes the arguments as an array
=========================================
One
Func_get_arg, Func_get_arg, func_num_argsclass test{public function Hello ($a, $b, $c, $d) { $num =func_num_args (); echo "The number of method parameters is:". $num, ""; The third parameter of the IF (2<= $num) { echo "method is:". Func_get_arg (2). "; } $num 2=func_get_args (); for ($i =0; $i < $num; $i + +) { echo {$i} parameters are {$num 2[$i]} "." ";}} $T =new Test (); $T->hello (' A ', ' B ', ' C ', ' D ');//The number of method parameters is: the third parameter of the 4//method is: c//No. 0 parameter is a//1th parameter is b//2nd parameter is c//3rd parameter is D
This article will explain the function of PHP common function analysis, more relevant content please focus on PHP Chinese web.