eval function

From: Date: Fri, 22 Aug 2003 22:38:32 +0000
Subject: eval function
Groups: php.general 
Request: Send a blank email to php-general+get-160461@lists.php.net to get a copy of this message
Hi php-general, I have a question about eval(); I'm having multiple pagenames I store in a database. I also have a lot of functions starting with "content" and then the name of the pages taken from the database. Ex: pagenames = about,download functions = contentAbout(), contentDownload(). Now I would like to have a loop of if to make the decision which function to use, like: for($i = 0; $i < sizeof($databasepagename);$i++){ if($_SERVER["PHP_SELF"] == $databasepagename[$i]) eval("content".$databasepagename[$i]."();"); } but that doesn't work... How could I achieve that? Thanks for answering... SvT -- Who is the ennemy?

« previous php.general (#160461) next »