March 2nd, 2005


(no subject)

Are there PHP people amongst my readers? Just in case there are, a quick question: I want to be able to have a large number of small functions able to be imported dynamically. Only one such function-set will be imported per page-load. I currently have this being done in one case with
$functionfile='monster_fish.php'; #filename actually taken from a safe list of files
monster_function($a,$b); # monster_function($a,$b) is defined in every functionfile
But I'm not sure this will always be okay with mod_php - I know mod_perl would get angry doing the equivalent because of persistent namespace. Is PHP okay with this? If not, how could a similar thing be done? And the other question is, if I wanted small snippets of PHP to be executed from a database entry rather than from a file, is there a way to do that other than eval()? And if not, is eval() reasonably efficient? (I can work with a no to both of those, but I'd like to know whether I have to.)

For those of you who aren't programmers at all, pretend this post was a picture of something very funny. Use your imagination you lazy git.