xref: /PHP-8.3/ext/simplexml/tests/009b.phpt (revision 7f2f0c00)
1--TEST--
2SimpleXML: foreach
3--EXTENSIONS--
4simplexml
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--EXPECTF--
22object(SimpleXMLElement)#%d (3) {
23  ["@attributes"]=>
24  array(1) {
25    ["id"]=>
26    string(5) "elem1"
27  }
28  ["elem1"]=>
29  string(10) "Bla bla 1."
30  ["elem11"]=>
31  string(10) "Bla bla 2."
32}
33