加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

func_num_args,func_get_arg和func_get_args从php 5.2到5.3的行

发布时间:2020-12-13 14:07:06 所属栏目:PHP教程 来源:网络整理
导读:我已经看到了 PHP手册.但是我不明白早期版本和更高版本的PHP之间的行为差??异.我不明白这个说法: Because this function depends on the current scope to determine parameter details,it cannot be used as a function parameter in versions prior to 5.
我已经看到了 PHP手册.但是我不明白早期版本和更高版本的PHP之间的行为差??异.我不明白这个说法:

Because this function depends on the current scope to determine parameter details,it cannot be used as a function parameter in versions prior to 5.3.0. If this value must be passed,the results should be assigned to a variable,and that variable should be passed.

如果要将其中一个函数的结果传递给另一个函数或方法,那么在5.3之前的PHP版本中,您必须首先将结果分配给变量.
function some_func() {
    $args = func_get_args();
    some_other_func($args);
}

PHP 5.3中删除了这个限制,现在可以直接传递结果.

function some_func() {
    some_other_func(func_get_args());
}

至于为什么这个限制首先存在,也许有一个更全面了解PHP内部的人可以给你一个更完整的答案.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读