3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '<?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don\'t forget me this weekend!</body> <recursive> <val>2</val> <val>4</val> </recursive> </note>'; $xml1 = new SimpleXmlIterator($str, 0, false); $xml = (array) $xml1; var_dump($xml); echo $xml['note']['to']; echo $xml['note']['recursive']['val'][0];
Output for git.master, git.master_jit
array(5) { ["to"]=> string(4) "Tove" ["from"]=> string(4) "Jani" ["heading"]=> string(8) "Reminder" ["body"]=> string(29) "Don't forget me this weekend!" ["recursive"]=> object(SimpleXMLIterator)#2 (1) { ["val"]=> array(2) { [0]=> string(1) "2" [1]=> string(1) "4" } } } Warning: Undefined array key "note" in /in/B7lnC on line 20 Warning: Trying to access array offset on value of type null in /in/B7lnC on line 20 Warning: Undefined array key "note" in /in/B7lnC on line 21 Warning: Trying to access array offset on value of type null in /in/B7lnC on line 21 Warning: Trying to access array offset on value of type null in /in/B7lnC on line 21 Warning: Trying to access array offset on value of type null in /in/B7lnC on line 21
Output for rfc.property-hooks
array(5) { ["to"]=> string(4) "Tove" ["from"]=> string(4) "Jani" ["heading"]=> string(8) "Reminder" ["body"]=> string(29) "Don't forget me this weekend!" ["recursive"]=> object(SimpleXMLIterator)#2 (1) { ["val"]=> array(2) { [0]=> string(1) "2" [1]=> string(1) "4" } } } Warning: Undefined array key "note" in /in/B7lnC on line 20 Warning: Trying to access array offset on null in /in/B7lnC on line 20 Warning: Undefined array key "note" in /in/B7lnC on line 21 Warning: Trying to access array offset on null in /in/B7lnC on line 21 Warning: Trying to access array offset on null in /in/B7lnC on line 21 Warning: Trying to access array offset on null in /in/B7lnC on line 21

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:
78.85 ms | 402 KiB | 8 Q