note 62847 deleted from language.variables.variable by danbrown

From: Date: Wed, 24 Jun 2009 16:53:22 +0000
Subject: note 62847 deleted from language.variables.variable by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-157395@lists.php.net to get a copy of this message
Note Submitter: jkimball4 [at) gmail (dot] c.o.m ---- 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}(); } ?>

« previous php.notes (#157395) next »