PHP,如何将func-get-args值作为参数列表传递给另一个函数? [英] PHP, how to pass func-get-args values to another function as list of arguments?

查看:63
本文介绍了PHP,如何将func-get-args值作为参数列表传递给另一个函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个函数(my_function()),该函数获取无限数量的参数并将其传递给另一个函数(call_another_function()).

I want to create a function (my_function()) getting unlimited number of arguments and passing it into another function (call_another_function()).

function my_function() {    
   another_function($arg1, $arg2, $arg3 ... $argN);    
}

因此,要致电my_function(1,2,3,4,5)并开始致电another_function(1,2,3,4,5)

So, want to call my_function(1,2,3,4,5) and get calling another_function(1,2,3,4,5)

我知道我应该使用func_get_args()将所有函数参数作为数组获取,但是我不知道如何将此参数传递给另一个函数.

I know that I shoud use func_get_args() to get all function arguments as array, but I don't know how to pass this arguments to another function.

谢谢.

推荐答案

尝试在编程和计算机科学中,这称为应用函数.

In programming and computer science, this is called an apply function.

这篇关于PHP,如何将func-get-args值作为参数列表传递给另一个函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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