PHP函数找出传递给函数的参数数量? [英] PHP function to find out the number of parameters passed into function?

查看:127
本文介绍了PHP函数找出传递给函数的参数数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个PHP函数找到的参数的数量要接收/传递给特定功能

Is there a PHP function to find the number of parameters to be received/passed to a particular function?

推荐答案

func_num_args

获取传递给函数的参数数目。

Gets the number of arguments passed to the function.

下面是从上面的链接,

<?php
function foo()
{
    $numargs = func_num_args();
    echo "Number of arguments: $numargs\n";
}

foo(1, 2, 3);   
?>

它输出,

Number of arguments: 3

这篇关于PHP函数找出传递给函数的参数数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆