Bug #843: Cannot assign to object instance variable within an array of objects
| From: | palle at simonsens dot com | Date: | Sat, 10 Oct 1998 20:07:21 +0000 |
| Subject: | Bug #843: Cannot assign to object instance variable within an array of objects | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1787@lists.php.net to get a copy of this message | ||
From: palle@simonsens.com
Operating system: Linux /Redhat
PHP version: 3.0.5
PHP Bug Type: Parser error
Bug description: Cannot assign to object instance variable within an array of objects
I have checked in the mailings lists and have found no way to do this, only one other user (css -
sutherland) complaining about the same.
Here goes:
How do you assign to an object instance variable within an array?
// This is somewhat perverted w.r.t. my orig. code
// ... lot of class definitions, db queries and such ...
// This is from within a class function. The class has a "has-part" rel. to CartItem
$this->items[i] = new CartItem();
$this->items[1]->amnt++; // Parser error
$item = $this->items[1];
$item->amnt++; // No parser error, but assignments are by value, so nothing
// happens to "items[1]
I have also tried fiddling with the {} syntax of $$ variables, but to no avail - help!
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net