Does anyone know if there is a way to call a php function that is stored in a string...ie
I have an exception table which has the format
ID Exception Name Function Call
1 send_to_top doSendOff
So i check the database and find the function call where exception name = send_to_top
I now have this function in a variable which i want to know if there is a way to now call this function straight from the variable,thanks.
Call function thats stored in a string
Moderator: General Moderators
Code: Select all
eval();- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
eval(), bad idea. call_user_func(), good idea.
Will that work on a function pulled from a database?feyd wrote:eval(), bad idea. call_user_func(), good idea.
eval should be depreciated - it teaches very bad coding practice.
About the problem: a string is a string independent if its called from a database, flat file, calculation, rss feed, post var. You can also call a function like this:
About the problem: a string is a string independent if its called from a database, flat file, calculation, rss feed, post var. You can also call a function like this:
Code: Select all
$value = $function( $param );