note 8795 deleted from function.xml-parse-into-struct by sniper
| From: | sniper@php.net | Date: | Fri, 05 Dec 2003 00:32:14 +0000 |
| Subject: | note 8795 deleted from function.xml-parse-into-struct by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-61420@lists.php.net to get a copy of this message | ||
Note Submitter: sbzoom@yahoo.com
----
What wasn't talked about here was how to access individual items of the new array of objects.
It is actually quite simple but I didn't find the correct documentation any any of the books I
have or on the site.
To access an element of an object under normal conditions:
$a = new MyObject;
print $a->$myvar;
But to access the object's variables when the object is part of an array you must drop the
leading "$" of the variable or it will not access it.
$a[0] = new MyObject;
print $a[0]->myvar;
Is the proper syntax. Hope this helps someone out there. It took me a day to learn this.
Charlie