Re: PHP 4.0 Bug #8150: extending call_user_func()'sfunctionality
| From: | Sebastian Bergmann | Date: | Thu, 07 Dec 2000 09:15:54 +0000 |
| Subject: | Re: PHP 4.0 Bug #8150: extending call_user_func()'sfunctionality | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-40326@lists.php.net to get a copy of this message | ||
sbergmann@php.net wrote:
> 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? */
> );
> }
Forgot to tell: The easiest way to implement this would be a
call_user_func_array( $func_name, $func_args[] )
function, that calls the function $func_name and gives $func_args[0] as
first argument, and so on.
--
<? print implode( "", array_reverse( preg_split( "//", "dlrow laer
" .
"eht ot emoclew" ) ) ); /* visit http://www.sebastian-bergmann.de/ */ ?>