Reputation: 321
Lets say I want to save function in database. For example we have table function with attributes: function and function name. For saving function for time we would save it in data base:
time_funtion(){ return time() } and "Time"
.
I have no idea how to execute this function after reading from DB is this even possible?
I could do this with files - read from database then write it in file, then include file and calling this function will work. Any other ideas?
Upvotes: 0
Views: 503
Reputation: 11020
You can use eval() for this. But be careful what you save into your db. There are just a few problems where this is a useful approach. In 99% you don't need this and it's lacking security, because you are executing unkown code, which is not what you want.
Upvotes: 2