--TEST-- SimpleXML: foreach --EXTENSIONS-- simplexml --FILE-- Plain text. Bla bla 1. Here we have some text data. And here some more. Wow once again. Bla bla 2. EOF ); foreach($sxe->children() as $name=>$val) { var_dump($name); var_dump(get_class($val)); var_dump(trim($val)); } ?> --EXPECT-- string(5) "elem1" string(16) "SimpleXMLElement" string(10) "Bla bla 1." string(6) "elem11" string(16) "SimpleXMLElement" string(10) "Bla bla 2."