Re: eval function

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

« previous php.general (#160481) next »