3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = <<<XML <a> <foo name="one" game="lonely">1</foo> </a> XML; $xml = simplexml_load_string($string); var_dump($xml->foo[0]->attributes());die; foreach($xml->foo[0]->attributes() as $a => $b) { echo $a,'="',$b,"\"\n"; } ?>
based on rv9R9
Output for 5.1.2 - 7.2.0
object(SimpleXMLElement)#2 (1) { ["@attributes"]=> array(2) { ["name"]=> string(3) "one" ["game"]=> string(6) "lonely" } }
Output for 5.1.0 - 5.1.1
object(SimpleXMLElement)#2 (0) { }
Output for 5.0.0 - 5.0.5
object(SimpleXMLElement)#2 (1) { [0]=> string(3) "one" }
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_string() in /in/2JtAr on line 8
Process exited with code 255.
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.4
Fatal error: Call to undefined function: simplexml_load_string() in /in/2JtAr on line 8
Process exited with code 255.
Output for 4.4.2
Fatal error: Call to undefined function: simplexml_load_string() in /in/2JtAr on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_string() in /in/2JtAr on line 8