I found the [] operator is sometimes confusing when it is used agains SimpleXMLElement object.
$level_a = $xml->children();
$level_a['name']; # this returns the 'name' attribute of level_a (SimpleXmlElement object)
$level_a[0]; # this returns $level_a itself!
$level_a[1]; # this returns the second SimpleXmlElement object under root node. (Same level as level_a)
I can't find any documents about the numeric indexing usage of SimpleXmlElement class. Can anybody explain how those two worked?
Note that it seems this [num] operator of SimpleXmlElement just mimic the behavior of Array. I feel that this is not something stirred with Array, but the implementation of SimpleXmlElement class.