note 8795 added to xml_parse_into_struct
| From: | sbzoom at yahoo dot com | Date: | Thu, 28 Sep 2000 10:07:25 +0000 |
| Subject: | note 8795 added to xml_parse_into_struct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5536@lists.php.net to get a copy of this message | ||
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:<p>
$a = new MyObject;<br>
print $a->$myvar;<p>
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.<p>
$a[0] = new MyObject;<br>
print $a[0]->myvar;<p>
Is the proper syntax. Hope this helps someone out there. It took me a day to learn this.<p>
Charlie
http://www.php.net/manual/function.xml-parse-into-struct.php