本篇将讲解php常用函数处理的函数解析。
func_get_arg — 返回参数列表的某一项
func_get_args — 返回一个包含函数参数列表的数组
func_num_args — 返回传递给函数的参数个数
call_user_func — 把第一个参数作为回调函数调用
立即学习“PHP免费学习笔记(深入)”;
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<$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本篇将讲解php常用函数处理的函数解析,更多相关内容请关注php中文网。
相关推荐:
以上就是php常用函数处理的函数解析的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号