php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #8150 extending call_user_func()'s functionality
Submitted: 2000-12-06 23:36 UTC Modified: 2000-12-07 04:53 UTC
From: sbergmann@php.net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0 Latest CVS (06/12/2000) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
38 + 47 = ?
Subscribe to this entry?

 
 [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? */
                   );
  }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-07 04:53 UTC] sterling@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 00:01:32 2024 UTC