note 18246 added to language.variables.variable
| From: | chuck at efn dot org | Date: | Wed, 16 Jan 2002 00:30:52 +0000 |
| Subject: | note 18246 added to language.variables.variable | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-24859@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?
--
http://www.php.net/manual/en/language.variables.variable.php
http://master.php.net/manage/user-notes.php?action=edit+18246
http://master.php.net/manage/user-notes.php?action=delete+18246
http://master.php.net/manage/user-notes.php?action=reject+18246