faqts : Computers : Programming : Languages : PHP : kms : Functions

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

21 of 34 people (62%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

Can I use variable function names in PHP?

May 3rd, 2001 09:59
Philip Olson, Nathan Wallace,


Try something like the following:
    $fn_name = 'myfunc';
    $result = $fn_name($arg1, $arg2);
Then the function called myfunc (specified in the variable $fn_name)
will be called.  The above will be just like doing :
    $result = myfunc($arg1, $arg2);
Also, be sure to check out :
    PHP Manual : Variable functions
    -------------------------------------------------------------
    http://www.php.net/manual/en/functions.variable-functions.php