xref: /PHP-7.0/ext/simplexml/tests/009b.phpt (revision 610c7fbe)
1--TEST--
2SimpleXML: foreach
3--SKIPIF--
4<?php if (!extension_loaded("simplexml")) print "skip"; ?>
5--FILE--
6<?php
7$sxe = simplexml_load_string(<<<EOF
8<?xml version='1.0'?>
9<!DOCTYPE sxe SYSTEM "notfound.dtd">
10<sxe id="elem1">
11 Plain text.
12 <elem1 attr1='first'>Bla bla 1.<!-- comment --><elem2>
13   Here we have some text data.
14  </elem2></elem1>
15 <elem11 attr2='second'>Bla bla 2.</elem11>
16</sxe>
17EOF
18);
19var_dump($sxe->children());
20?>
21===DONE===
22<?php exit(0); ?>
23--EXPECTF--
24object(SimpleXMLElement)#%d (3) {
25  ["@attributes"]=>
26  array(1) {
27    ["id"]=>
28    string(5) "elem1"
29  }
30  ["elem1"]=>
31  string(10) "Bla bla 1."
32  ["elem11"]=>
33  string(10) "Bla bla 2."
34}
35===DONE===
36