3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>'. '<request><body test2="321" test3="987">'. '<rows><my-row test4="564">'. '<types>'. '<custom>this is the example of the text</custom>'. '<Generic arch="simple">this is the example of the text</Generic>'. '<bold/><italic/><underlined/>'. '</types>'. '</my-row><my-row test5="565"/><test hidden="false" ready="true"/></rows>'. '</body></request>'; function f($xml){ foreach ($xml as $key => $value) { var_dump($key, $value->hasChildren(), $value, '============='); if (get_class($value) == 'SimpleXMLIterator') f($value); } } f(new SimpleXMLIterator($s));
Output for git.master, git.master_jit, rfc.property-hooks
string(4) "body" bool(false) object(SimpleXMLIterator)#3 (2) { ["@attributes"]=> array(2) { ["test2"]=> string(3) "321" ["test3"]=> string(3) "987" } ["rows"]=> object(SimpleXMLIterator)#4 (2) { ["my-row"]=> array(2) { [0]=> object(SimpleXMLIterator)#5 (2) { ["@attributes"]=> array(1) { ["test4"]=> string(3) "564" } ["types"]=> object(SimpleXMLIterator)#8 (5) { ["custom"]=> string(31) "this is the example of the text" ["Generic"]=> string(31) "this is the example of the text" ["bold"]=> object(SimpleXMLIterator)#9 (0) { } ["italic"]=> object(SimpleXMLIterator)#10 (0) { } ["underlined"]=> object(SimpleXMLIterator)#11 (0) { } } } [1]=> object(SimpleXMLIterator)#6 (1) { ["@attributes"]=> array(1) { ["test5"]=> string(3) "565" } } } ["test"]=> object(SimpleXMLIterator)#7 (1) { ["@attributes"]=> array(2) { ["hidden"]=> string(5) "false" ["ready"]=> string(4) "true" } } } } string(13) "=============" string(4) "rows" bool(false) object(SimpleXMLIterator)#7 (2) { ["my-row"]=> array(2) { [0]=> object(SimpleXMLIterator)#6 (2) { ["@attributes"]=> array(1) { ["test4"]=> string(3) "564" } ["types"]=> object(SimpleXMLIterator)#11 (5) { ["custom"]=> string(31) "this is the example of the text" ["Generic"]=> string(31) "this is the example of the text" ["bold"]=> object(SimpleXMLIterator)#10 (0) { } ["italic"]=> object(SimpleXMLIterator)#9 (0) { } ["underlined"]=> object(SimpleXMLIterator)#12 (0) { } } } [1]=> object(SimpleXMLIterator)#5 (1) { ["@attributes"]=> array(1) { ["test5"]=> string(3) "565" } } } ["test"]=> object(SimpleXMLIterator)#8 (1) { ["@attributes"]=> array(2) { ["hidden"]=> string(5) "false" ["ready"]=> string(4) "true" } } } string(13) "=============" string(6) "my-row" bool(false) object(SimpleXMLIterator)#5 (2) { ["@attributes"]=> array(1) { ["test4"]=> string(3) "564" } ["types"]=> object(SimpleXMLIterator)#6 (5) { ["custom"]=> string(31) "this is the example of the text" ["Generic"]=> string(31) "this is the example of the text" ["bold"]=> object(SimpleXMLIterator)#11 (0) { } ["italic"]=> object(SimpleXMLIterator)#12 (0) { } ["underlined"]=> object(SimpleXMLIterator)#9 (0) { } } } string(13) "=============" string(5) "types" bool(false) object(SimpleXMLIterator)#9 (5) { ["custom"]=> string(31) "this is the example of the text" ["Generic"]=> string(31) "this is the example of the text" ["bold"]=> object(SimpleXMLIterator)#12 (0) { } ["italic"]=> object(SimpleXMLIterator)#11 (0) { } ["underlined"]=> object(SimpleXMLIterator)#10 (0) { } } string(13) "=============" string(6) "custom" bool(false) object(SimpleXMLIterator)#11 (1) { [0]=> string(31) "this is the example of the text" } string(13) "=============" string(7) "Generic" bool(false) object(SimpleXMLIterator)#12 (2) { ["@attributes"]=> array(1) { ["arch"]=> string(6) "simple" } [0]=> string(31) "this is the example of the text" } string(13) "=============" string(4) "bold" bool(false) object(SimpleXMLIterator)#11 (0) { } string(13) "=============" string(6) "italic" bool(false) object(SimpleXMLIterator)#12 (0) { } string(13) "=============" string(10) "underlined" bool(false) object(SimpleXMLIterator)#11 (0) { } string(13) "=============" string(6) "my-row" bool(false) object(SimpleXMLIterator)#9 (1) { ["@attributes"]=> array(1) { ["test5"]=> string(3) "565" } } string(13) "=============" string(4) "test" bool(false) object(SimpleXMLIterator)#5 (1) { ["@attributes"]=> array(2) { ["hidden"]=> string(5) "false" ["ready"]=> string(4) "true" } } string(13) "============="

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
44.77 ms | 413 KiB | 8 Q