Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP dynamic function 1

Status
Not open for further replies.

elfuser

Programmer
Feb 22, 2005
3
0
0
CA
Hello

Is there a way I can assign a function name to a string or reference and then call it?

$func = 'name_of_function'

or

$func = &name_of_function()

and then be able to use the variable to call the function?

I can't seem to find this in the manual.
 
i believe you can do this with the curly brace syntax.

e.g.
Code:
$func = "somefunctionname";
$result  = {$func}(params);
i am not certain that you need the curly braces even. i think that php assumes that a variable is a function if it is immediately followed by round brackets.

see
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top