--TEST-- Bug #72588 (Using global var doesn't work while accessing SimpleXML element) --SKIPIF-- --FILE-- EOF; $tplxml = simplexml_load_string($xmlStruct); var_dump($tplxml->object[$tpnb]); ?> --EXPECTF-- object(SimpleXMLElement)#%d (1) { ["@attributes"]=> array(2) { ["type"]=> string(5) "obj_6" ["label"]=> string(18) "Label for object 6" } }