--TEST-- SimpleXML: foreach --SKIPIF-- --FILE-- Plain text. Bla bla 1. Here we have some text data. Bla bla 2. EOF ); var_dump($sxe->children()); ?> --EXPECTF-- object(SimpleXMLElement)#%d (3) { ["@attributes"]=> array(1) { ["id"]=> string(5) "elem1" } ["elem1"]=> object(SimpleXMLElement)#%d (3) { ["@attributes"]=> array(1) { ["attr1"]=> string(5) "first" } ["comment"]=> object(SimpleXMLElement)#%d (0) { } ["elem2"]=> string(35) " Here we have some text data. " } ["elem11"]=> object(SimpleXMLElement)#%d (2) { ["@attributes"]=> array(1) { ["attr2"]=> string(6) "second" } [0]=> string(10) "Bla bla 2." } }