note 44889 added to functions.variable-functions

From: Date: Thu, 19 Aug 2004 12:36:54 +0000
Subject: note 44889 added to functions.variable-functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-79923@lists.php.net to get a copy of this message
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". ---- Manual Page -- http://www.php.net/manual/en/functions.variable-functions.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44889 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44889&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44889&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#79923) next »