我的PHP腳本中有一個非常簡單的問題。有這需要可變長度參數列表定義的函數:PHP - 傳遞數組作爲可變長度參數列表
function foo() {
// func_get_args() and similar stuff here
}
當我這樣稱呼它,它工作得很好:
foo("hello", "world");
但是,我有我的數組變量和我需要將它們「分開」作爲函數的單個參數傳遞給它們。例如:
$my_args = array("hello", "world");
foo(do_some_stuff($my_args));
是否有任何do_some_stuff功能,拆分論據我,所以我可以將它們傳遞給函數?
[傳遞數組作爲參數,而不是一個陣列,在PHP]的可能重複(http://stackoverflow.com/questions/744145/passing-an-array-as-arguments-not-an-array-in -php) – DanMan 2014-02-18 14:31:03