note 11672 added to Classes and Objects
| From: | teriumNOSPAM at techie dot com | Date: | Thu, 01 Mar 2001 22:49:31 +0000 |
| Subject: | note 11672 added to Classes and Objects | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11730@lists.php.net to get a copy of this message | ||
You cannot get object values in a for loop in a class:
class foo {
var $var;
function foo() {
$this->var = true;
}
function print() {
print($this->var); //Will work
for ($i = 0; $i < 5; $i++) {
print($this->var); //Will NOT work
}
}
}
$class = new foo;
$class->print;
http://www.php.net/manual/en/language.oop.php