3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function ReadXml($xmlstr) { $xml = new \SimpleXmlElement($xmlstr); var_dump($xml->getName()); } $xmlstr= '<Address><to>James</to><from>Jani</from><heading>Reminder</heading><body>Please check your mail.</body></Address>'; ReadXml($xmlstr);
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string(7) "Address"
Output for 5.1.3 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/2gPSG on line 5 string(7) "Address"
Output for 5.0.0 - 5.1.2
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/2gPSG on line 5 Fatal error: Call to undefined method SimpleXMLElement::getName() in /in/2gPSG on line 6
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/2gPSG on line 5 Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/2gPSG on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/2gPSG on line 5 Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/2gPSG on line 5