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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a function name through a variable! 1

Status
Not open for further replies.

FOR111

Programmer
Sep 29, 2005
103
MT
Hi All,

I don't know if this is possible..though i need to ask! Is it possible to run a function name having it stored in a variable? Don;t if i explained my self well so i'll try with an example:

$function = "SelectUser";

RunFunction($function, $params);

function RunFunction($function_name, $parametrs)
{
$function_name($parameters)

}


Hope this makes it clearer!

Thanks
Nick
 
yes

Code:
$function = "somefunction";

$function();

function somefunction() {
echo "hello";
}

your system should work too although you would need to find a way to ensure that you were passing the right number of parameters to each function.
 
Hi jpadie...great..awesome!! it worked hehe...

About the params...it would be handled sepertaly, so it shouldn't pose any problems..but thanks for pointing it out!

Best Regards
Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top