php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #5350 call_function("function_name", array args); ala execv()
Submitted: 2000-07-04 04:53 UTC Modified: 2001-01-21 04:01 UTC
From: drago at 0x00 dot org Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.0 OS: Linux
Private report: No CVE-ID: None
 [2000-07-04 04:53 UTC] drago at 0x00 dot org
$args=array("foo", "bar", "geek");
call_function("f", $args);

function f($f1, $f2, $f3) {
    echo "$f1 $f2 $f3";
}

Output: foo bar geek

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-04 10:36 UTC] stas at cvs dot php dot net
What prevents you from doing:
$func(array("foo", "bar", "geek")) and opening that array in function?
 [2000-07-04 15:02 UTC] drago at 0x00 dot org
I am looking to use this with existing PHP functions, not user space ones.
Specifically I would like to use this with ibase_execute() for the bindings.
I am writting a little database wrapper and I need to be able to do...
$res=DB("select * from Foo where bar=?", $reallygeeky);
and that arg list is of variable length so I want to be able to do my custom stuff in DB() then toss the args in an array and call ibase_execute.
I have it working as it is, but it is ugly.  Right now I am building up eval() code and having it return the resource into a global var.  Its ugly :)
Would be much easier if I could just build up an array and call call_function("ibase_execute", $theargs);
 [2000-08-15 10:45 UTC] waldschrott@php.net
that possibly makes sense, you?ve currently no option but using eval() to transorm passed array args to an argument list...
 [2001-01-21 04:01 UTC] cynic@php.net
call_user_func_array()
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 19:01:29 2024 UTC