本篇将讲解php常用函数处理的函数解析。
func_get_arg — 返回参数列表的某一项
func_get_args — 返回一个包含函数参数列表的数组
func_num_args — 返回传递给函数的参数个数
call_user_func — 把第一个参数作为回调函数调用
call_user_func_array —调用回调函数,并把一个数组参数作为回调函数的参数
forward_static_call_array — Call a static method and pass the arguments as array
forward_static_call — 调用静态方法并将参数作为数组传递
=========================================
一、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
echo "第{$i}个参数为{$num2[$i]}"."
";
}
}
}
$T=new test();
$T->hello('A','B','C','D');
//方法参数的个数为:4
//方法的第三个参数为:C
//第0个参数为A
//第1个参数为B
//第2个参数为C
//第3个参数为D
本篇将讲解php常用函数处理的函数解析,更多相关内容请关注php中文网。
相关推荐: