note 23144 added to language.oop
| From: | ianyates at yahoo dot com | Date: | Wed, 10 Jul 2002 16:22:53 +0000 |
| Subject: | note 23144 added to language.oop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32847@lists.php.net to get a copy of this message | ||
In response to untouchable@attbi.com's query.
You have defined one element of the $obj variable (element 10) to be the object and then called
element 0's object (which wasn't previously set).
To get this to work you need to use the same elements of the $obj variable as below:
$obj[10] = new testClass;
$obj[10]->a = 4;
$obj[10]->printa();
If I'm right, it looks like you wanted to create an array of 10 objects and were trying to use
the first one.
From my opinion you'd have to make each element an object for this to work.
--
http://www.php.net/manual/en/language.oop.php
http://master.php.net/manage/user-notes.php?action=edit+23144
http://master.php.net/manage/user-notes.php?action=delete+23144
http://master.php.net/manage/user-notes.php?action=reject+23144