3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<'XML' <foo bar="baz" tab="taz"> <bar> </foo> XML; $xml = new SimpleXmlElement($xml); var_dump($xml->getName()); var_dump($xml->attributes()); var_dump($xml->children());
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : Opening and ending tag mismatch: bar line 2 and foo in /in/9sXna on line 9 Warning: SimpleXMLElement::__construct(): </foo> in /in/9sXna on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/9sXna on line 9 Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : Premature end of data in tag foo line 1 in /in/9sXna on line 9 Warning: SimpleXMLElement::__construct(): </foo> in /in/9sXna on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/9sXna on line 9 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/9sXna:9 Stack trace: #0 /in/9sXna(9): SimpleXMLElement->__construct('<foo bar="baz" ...') #1 {main} thrown in /in/9sXna on line 9
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : Opening and ending tag mismatch: bar line 2 and foo in /in/9sXna on line 9 Warning: SimpleXMLElement::__construct(): </foo> in /in/9sXna on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/9sXna on line 9 Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : Premature end of data in tag foo line 1 in /in/9sXna on line 9 Warning: SimpleXMLElement::__construct(): </foo> in /in/9sXna on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/9sXna on line 9 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/9sXna:9 Stack trace: #0 /in/9sXna(9): SimpleXMLElement->__construct('<foo bar="baz" ...') #1 {main} thrown in /in/9sXna on line 9
Process exited with code 255.

preferences:
240.68 ms | 403 KiB | 327 Q