Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: newbie question for XML.. why array == 1st element [Thread Next] Re: newbie question for XML.. why array == 1st elementTo: NULL Date: 3/1/2008 9:44:00 AM On Feb 29, 11:51 pm, petersprc <peters...@gmail.com> wrote: > Hi, > > This is because simple XML nodes are stored internally as objects in a > linked list. > > When you use the arrow (->) operator, the first matching child is > returned by the read_property object handler. > > When all of a node's properties are fetched as a result of executing > print_r, children with the same name are combined into an array by the > get_properties object handler. > > SimpleXMLElement implements the Travesable interface, which allows you > to iterate over these objects using foreach. > > More info on object handler functions is here:http://www.php-mag.net/magphpde/magphpde_article/psecom,id,382,nodeid... that's interesting... so in other words... if i pass $xml->note to a function, the memory of exactly 1 node is passed. in other language... a linked list will have a member variable $next that explicitly points to the next member... so in PHP, it looks like a node, without having a $next... and yet it is a linked list. and print_r will print it as an Array type. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
