3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string="<xml>a & b</xml>"; $xml = new SimpleXMLElement($string); print_r($xml);
based on cSOo8
Output for 7.0.0 - 7.2.0
Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : xmlParseEntityRef: no name in /in/pciYG on line 5 Warning: SimpleXMLElement::__construct(): <xml>a & b</xml> in /in/pciYG on line 5 Warning: SimpleXMLElement::__construct(): ^ in /in/pciYG on line 5 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/pciYG:5 Stack trace: #0 /in/pciYG(5): SimpleXMLElement->__construct('<xml>a & b</xml...') #1 {main} thrown in /in/pciYG on line 5
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : xmlParseEntityRef: no name in /in/pciYG on line 5 Warning: SimpleXMLElement::__construct(): <xml>a & b</xml> in /in/pciYG on line 5 Warning: SimpleXMLElement::__construct(): ^ in /in/pciYG on line 5 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/pciYG:5 Stack trace: #0 /in/pciYG(5): SimpleXMLElement->__construct('<xml>a & b</xml...') #1 {main} thrown in /in/pciYG on line 5
Process exited with code 255.