Home > Article > Backend Development > Function analysis of php common function processing
This article will explain the function analysis of commonly used functions in PHP.
func_get_arg — Returns an item in the parameter list
func_get_args — Returns an array containing the function parameter list
func_num_args — Returns the number of parameters passed to the function
call_user_func — Call the first parameter as the callback function
call_user_func_array — Call the callback function and pass 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 — Call a static method and pass the arguments as an array
======================== ==================
1.
func_get_arg、func_get_arg、func_num_args class test{ public function hello($a,$b,$c,$d){ $num=func_num_args(); echo "方法参数的个数为:".$num," "; if(2<=$num){ echo "方法的第三个参数为:".func_get_arg(2)." "; } $num2=func_get_args(); for($i=0;$i<$num;$i++){ echo "第{$i}个参数为{$num2[$i]}"." "; } } } $T=new test(); $T->hello('A','B','C','D'); //方法参数的个数为:4 //方法的第三个参数为:C //第0个参数为A //第1个参数为B //第2个参数为C //第3个参数为D
This article will explain the function analysis of commonly used functions in PHP. For more related content, please Follow php Chinese website.
Related recommendations:
PHP The simplest way to verify logged in users (basic form user verification)
Detailed explanation of the difference and use of const and static in php
The above is the detailed content of Function analysis of php common function processing. For more information, please follow other related articles on the PHP Chinese website!