Re: evaluating a variable
| From: | Brad Pauly | Date: | Mon, 22 Dec 2003 19:42:59 +0000 |
| Subject: | Re: evaluating a variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173185@lists.php.net to get a copy of this message | ||
On Mon, 2003-12-22 at 12:36, Carey Baird wrote:
> Hey,
>
> I have stored the name of a function as a variable. I have then passed the
> variable to another function as follows:
>
> //put function name in a variable
> $contentfunction = “newsadmincontent()”;
>
> //pass variable to another function
> Html_content($contentfunction);
>
> //function is:
> function html_content($contentfunction)
> {
> ?>
>
> <tr>
> <td colspan="2" valign="top">
> <table width="100%" height="390" border="1"
> cellpadding="0"
> cellspacing="0" bordercolor="#666666" bgcolor="#FFFFFF">
> <tr>
> <td valign="top">
> <?
> $contentfunction; //doesn’t work
> Echo $contentfunction; //outputs the name of the
> function but does not evaluate it
> Echo “<? “.$contentfunction.” ?>”; //outputs <?
> Newsadmincontent() ?> but does not evaluate it
> ?>
> </td>
> </tr>
> </table>
> </td>
> </tr>
>
> <?
> }
>
>
> This does seem like a simple question but I cannot find any information to
> help me. Can anyone tell me how to get the function to be executed here?
Try $$contentfunction
- Brad