note 62847 added to language.variables.variable
| From: | jkimball4 | Date: | Fri, 10 Mar 2006 19:49:22 +0000 |
| Subject: | note 62847 added to language.variables.variable | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-105237@lists.php.net to get a copy of this message | ||
The correct code for the previous entry is:
<?php
class foo
{
public $thing1 = 'a';
public $thing2 = 'b';
public $thing3 = 'c';
public function getThing1()
{
return $this->thing1;
}
public function getThing2()
{
return $this->thing2;
}
public function getThing3()
{
return $this->thing3;
}
}
$obj = new foo();
for($i=1;$i<=3 ;$i++) {
//note the very small change to the code inside the curly braces.
print $obj->{"getThing".$i}();
}
?>
----
Server IP: 66.163.161.117
Probable Submitter: 71.38.78.5
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.variables.variable.php
Edit -- http://master.php.net/note/edit/62847
Del: integrated -- http://master.php.net/note/delete/62847/integrated
Del: useless -- http://master.php.net/note/delete/62847/useless
Del: bad code -- http://master.php.net/note/delete/62847/bad+code
Del: spam -- http://master.php.net/note/delete/62847/spam
Del: non-english -- http://master.php.net/note/delete/62847/non-english
Del: in docs -- http://master.php.net/note/delete/62847/in+docs
Del: other reasons-- http://master.php.net/note/delete/62847
Reject -- http://master.php.net/note/reject/62847
Search -- http://master.php.net/manage/user-notes.php