3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xmlStr = '<?xml version="1.0"?><toplevel><CompleteSuggestion><suggestion data="ski360"/></CompleteSuggestion><CompleteSuggestion><suggestion data="ski 39"/></CompleteSuggestion><CompleteSuggestion><suggestion data="ski35"/></CompleteSuggestion><CompleteSuggestion><suggestion data="ski 3000"/></CompleteSuggestion><CompleteSuggestion><suggestion data="ski 33"/></CompleteSuggestion><CompleteSuggestion><suggestion data="ski 34"/></CompleteSuggestion></toplevel>'; $xmlObj = simplexml_load_string(utf8_encode($xmlStr)); var_dump(get_object_vars($xmlObj));
Output for 5.3.0 - 5.3.29, 5.5.27 - 5.5.38, 5.6.11 - 7.1.0
array(1) { ["CompleteSuggestion"]=> array(6) { [0]=> object(SimpleXMLElement)#2 (1) { ["suggestion"]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski360" } } } [1]=> object(SimpleXMLElement)#3 (1) { ["suggestion"]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski 39" } } } [2]=> object(SimpleXMLElement)#4 (1) { ["suggestion"]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(5) "ski35" } } } [3]=> object(SimpleXMLElement)#5 (1) { ["suggestion"]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(8) "ski 3000" } } } [4]=> object(SimpleXMLElement)#6 (1) { ["suggestion"]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski 33" } } } [5]=> object(SimpleXMLElement)#7 (1) { ["suggestion"]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski 34" } } } } }
Output for 5.4.28 - 5.4.45, 5.5.12 - 5.5.26, 5.6.0 - 5.6.10
array(1) { ["CompleteSuggestion"]=> array(6) { [0]=> object(SimpleXMLElement)#2 (1) { [0]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski360" } } } [1]=> object(SimpleXMLElement)#3 (1) { [0]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski 39" } } } [2]=> object(SimpleXMLElement)#4 (1) { [0]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(5) "ski35" } } } [3]=> object(SimpleXMLElement)#5 (1) { [0]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(8) "ski 3000" } } } [4]=> object(SimpleXMLElement)#6 (1) { [0]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski 33" } } } [5]=> object(SimpleXMLElement)#7 (1) { ["suggestion"]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski 34" } } } } }
Output for 5.4.0 - 5.4.27, 5.5.0 - 5.5.11
array(1) { ["CompleteSuggestion"]=> array(6) { [0]=> object(SimpleXMLElement)#2 (1) { [0]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski360" } } } [1]=> object(SimpleXMLElement)#3 (1) { [0]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski 39" } } } [2]=> object(SimpleXMLElement)#4 (1) { [0]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(5) "ski35" } } } [3]=> object(SimpleXMLElement)#5 (1) { [0]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(8) "ski 3000" } } } [4]=> object(SimpleXMLElement)#6 (1) { [0]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski 33" } } } [5]=> object(SimpleXMLElement)#7 (1) { [0]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski 34" } } } } }
Output for 5.1.2 - 5.2.17
array(1) { ["CompleteSuggestion"]=> array(6) { [0]=> object(SimpleXMLElement)#2 (1) { ["suggestion"]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski360" } } } [1]=> object(SimpleXMLElement)#3 (1) { ["suggestion"]=> object(SimpleXMLElement)#9 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski 39" } } } [2]=> object(SimpleXMLElement)#4 (1) { ["suggestion"]=> object(SimpleXMLElement)#10 (1) { ["@attributes"]=> array(1) { ["data"]=> string(5) "ski35" } } } [3]=> object(SimpleXMLElement)#5 (1) { ["suggestion"]=> object(SimpleXMLElement)#11 (1) { ["@attributes"]=> array(1) { ["data"]=> string(8) "ski 3000" } } } [4]=> object(SimpleXMLElement)#6 (1) { ["suggestion"]=> object(SimpleXMLElement)#12 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski 33" } } } [5]=> object(SimpleXMLElement)#7 (1) { ["suggestion"]=> object(SimpleXMLElement)#13 (1) { ["@attributes"]=> array(1) { ["data"]=> string(6) "ski 34" } } } } }
Output for 5.0.0 - 5.1.1
array(1) { ["CompleteSuggestion"]=> array(6) { [0]=> object(SimpleXMLElement)#2 (1) { ["suggestion"]=> object(SimpleXMLElement)#8 (0) { } } [1]=> object(SimpleXMLElement)#3 (1) { ["suggestion"]=> object(SimpleXMLElement)#9 (0) { } } [2]=> object(SimpleXMLElement)#4 (1) { ["suggestion"]=> object(SimpleXMLElement)#10 (0) { } } [3]=> object(SimpleXMLElement)#5 (1) { ["suggestion"]=> object(SimpleXMLElement)#11 (0) { } } [4]=> object(SimpleXMLElement)#6 (1) { ["suggestion"]=> object(SimpleXMLElement)#12 (0) { } } [5]=> object(SimpleXMLElement)#7 (1) { ["suggestion"]=> object(SimpleXMLElement)#13 (0) { } } } }
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_string() in /in/aQ2Wi on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: simplexml_load_string() in /in/aQ2Wi on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_string() in /in/aQ2Wi on line 4