|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-12-06 23:36 UTC] sbergmann@php.net
Imagine the following situation:
function foo()
{
// get arguments for call of foo()
$arg_list = func_get_args();
// call another function, depending on $arg_list
// and passing parts of $arg_list as parameters
call_user_func( "bar", /* how can i put here a
variable number of
arguments? */
);
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 19:00:02 2025 UTC |
use the call_user_func_array() function. // somefunc() a useless wrapper around // some_other_func().... function somefunc() { $args = func_get_args(); $ret = call_user_func_array("some_other_func", $args); return($ret); } call_user_func_array() is in the latest CVS or PHP 4.0.4 and up