3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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; echo $xml['note']['to']; echo $xml['note']['recursive']['val'][0];
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Undefined index: note in /in/cnQ8D on line 19 Notice: Undefined index: note in /in/cnQ8D on line 20
Output for 5.1.2 - 5.2.17
Notice: Undefined index: note in /in/cnQ8D on line 19 Notice: Undefined index: note in /in/cnQ8D on line 20
Output for 5.0.5 - 5.1.1
Fatal error: Uncaught exception 'Exception' with message 'SimpleXMLElement::__construct() expects exactly 1 parameter, 3 given' in /in/cnQ8D:16 Stack trace: #0 /in/cnQ8D(16): SimpleXMLElement->__construct('<?xml version="...', 0, false) #1 {main} thrown in /in/cnQ8D on line 16
Process exited with code 255.
Output for 5.0.3 - 5.0.4
Fatal error: Uncaught exception 'Exception' with message 'SimpleXMLElement::__construct() expects exactly 1 parameter, 3 given' in /in/cnQ8D:16 Stack trace: #0 /in/cnQ8D(16): SimpleXMLIterator->__construct('<?xml version="...', 0, false) #1 {main} thrown in /in/cnQ8D on line 16
Process exited with code 255.
Output for 5.0.0 - 5.0.2
Fatal error: Uncaught exception 'Exception' with message 'SimpleXMLElement::__construct() expects exactly 1 parameter, 3 given' in /in/cnQ8D:16 Stack trace: #0 {main} thrown in /in/cnQ8D on line 16
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: simplexmliterator in /in/cnQ8D on line 16
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: simplexmliterator in /in/cnQ8D on line 16