php-general | 2001032
Date: 03/24/01
- Next message: Adi Wibowo: "Re: [PHP] php4 but dont work with php3"
- Previous message: Jaxon: "[PHP] indirectly call function?"
- In reply to: Jaxon: "[PHP] indirectly call function?"
- Next in thread: Randy Johnson: "[PHP] random letters and numbers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
$module = "mod_news";
echo $module();
i think that's it.
or:
$module = "mod_news()";
eval("echo ".$module);
I think the former is faster.
-aaron
At 7:16 PM -0500 3/24/01, Jaxon wrote:
>hi all, I'm trying to change which function is called at runtime:
>
>e.g.
>page1.php:
>
>include "functions_def.inc.php"; //contains definition for mod_news()
>$module = "mod_news()"; //for example - gets assigned by case statement
>include page2.inc.php
>
>
>page2.inc.php:
>
><?php echo $module; ?>
>
>
>the page shows "mod_news()" instead of calling my function :(
>It works if I use <?php echo mod_news(); ?> but not if I'm trying to hold
>the function name in the variable.
>
>I've tried
><?php echo $module; ?>
><?php eval $module; ?>
><?php print $module; ?>
>
>all to no avail.
>
>any ideas?
>
>tks!
>jaxon
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe <email protected>
>For additional commands, e-mail: php-general-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Adi Wibowo: "Re: [PHP] php4 but dont work with php3"
- Previous message: Jaxon: "[PHP] indirectly call function?"
- In reply to: Jaxon: "[PHP] indirectly call function?"
- Next in thread: Randy Johnson: "[PHP] random letters and numbers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

