note 44889 deleted from functions.variable-functions by betz
| From: | betz@php.net | Date: | Mon, 15 Nov 2004 18:39:12 +0000 |
| Subject: | note 44889 deleted from functions.variable-functions by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-80553@lists.php.net to get a copy of this message | ||
Note Submitter: jxyuhua at yahoo dot com dot cn
----
in above example:
-------------------------------------------
<?php
class Foo
{
function Var()
{
$name = 'Bar';
$this->$name(); // This calls the Bar() method
}
function Bar()
{
echo "This is Bar";
}
}
$foo = new Foo();
$funcname = "Var";
$foo->$funcname(); // This calls $foo->Var()
?>
---------------------------------------------------
there is a wrong where you run it , its wrong message is :
------------------------------------------------------
Parse error: parse error, unexpected T_VAR, expecting T_STRING in D:\WebSamples\demo.php on line 4
----------------------------------------------------
so you should modify "Var" to another well format name , for example like
"VarName".