#22113 [Opn]: error in one of your documentation-examples

From: Date: Fri, 07 Feb 2003 19:33:14 +0000
Subject: #22113 [Opn]: error in one of your documentation-examples
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969351662@lists.php.net to get a copy of this message
ID: 22113 User updated by: elmarto@gmx.de Reported By: elmarto@gmx.de Status: Open Bug Type: Documentation problem Operating System: linux debian PHP Version: 4.3.0 New Comment: in your documentation on page http://www.php.net/manual/en/functions.variable-functions.php there is a mistake with the latest example 13.4. it says: <?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->$varname(); // This calls $foo->Var() ?> The $foo->$varname(); will produce an undefined function error. It has to be $foo->$funcname(); Previous Comments: ------------------------------------------------------------------------ [2003-02-07 13:32:01] elmarto@gmx.de in your documentation on page http://www.php.net/manual/en/functions.variable-functions.php there is a mistake with the latest example 13.4. it says: <?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->$varname(); // This calls $foo->Var() ?> The $foo->$varname(); will produce an undefined function error. It has to be $foo->funcname(); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22113&edit=1

« previous php.doc (#969351662) next »