传递数组作为参数,而不是一个数组,在PHP [英] Passing an Array as Arguments, not an Array, in PHP

查看:161
本文介绍了传递数组作为参数,而不是一个数组,在PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我好像记得,在PHP还有就是要传递一个数组作为一个函数的参数列表的方式,取消引用数组的标准 FUNC($ ARG1,$ ARG2)的方式。但现在我失去了对如何做到这一点。我记得通过引用传递的方式,如何来代替传入的参数......但不知道如何去列表中的数组的参数列表。

I seem to remember that in PHP there is a way to pass an array as a list of arguments for a function, dereferencing the array into the standard func($arg1, $arg2) manner. But now I'm lost on how to do it. I recall the manner of passing by reference, how to "glob" incoming parameters ... but not how to de-list the array into a list of arguments.

这可能是因为 FUNC一样简单(AMP&; $ myArgs),但我pretty肯定是不是。然而,可悲的是,php.net手动至今尚未透露任何事情。这并不是说我已经使用这个特定的功能在过去一年左右的时间。

It may be as simple as func(&$myArgs), but I'm pretty sure that isn't it. But, sadly, the php.net manual hasn't divulged anything so far. Not that I've had to use this particular feature for the last year or so.

推荐答案

<一个href=\"http://www.php.net/manual/en/function.call-user-func-array.php\">http://www.php.net/manual/en/function.call-user-func-array.php

call_user_func_array('func',$myArgs);

这篇关于传递数组作为参数,而不是一个数组,在PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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