note 18246 rejected from language.variables.variable by irc-html
| From: | irc-html@php.net | Date: | Wed, 16 Jan 2002 01:13:34 +0000 |
| Subject: | note 18246 rejected from language.variables.variable by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-24862@lists.php.net to get a copy of this message | ||
Is there a way to use a variable as a function name if the function is a PHP built-in? I've
tried:
$print_fn = 'print';
${$print_fn("print this")};
which results in:
Fatal error: Call to undefined function: print() in blah
If I do the same thing with a user-defined function:
function mprint($arg_value) {
print $arg_value;
}
$print_fn = 'mprint';
${$print_fn("print this")};
I get the output expected + much joy.
Any ideas?