I wonder is there any way that let's to dynamically load a piece of code at run time? For instance we have a simple "switch...case" statement like this:
switch($choice) {
case 'help':
load_from_db('help');
break;
case 'about':
load_from_db('about');
break;
}
And we have this database:
| keyword | command |
help require('help.php');
about echo 'Under construction.';
"load_from_db" is a function which is capable of reading from DB (we know how to do this) and execute corresponding command stored in the database (my question is this part).
Another example would be a simple "textarea" form which user can write some PHP code within and submit the form. At the server side code will be executed and result wil be shown to the user (I know this is not safe, this is just an example).
Any ideas?