3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xmlstr = <<<XML <?xml version='1.0' standalone='yes'?> <movies> <movie><test x="1">movie 1</test></movie> <movie><test x="2">movie 2</test></movie> XML; $movies = new SimpleXMLElement($xmlstr); foreach($movies->children() as $movie) { echo $movie->test; }
Output for 7.0.6 - 7.1.0
Warning: SimpleXMLElement::__construct(): Entity: line 4: parser error : Premature end of data in tag movies line 2 in /in/XrgLA on line 10 Warning: SimpleXMLElement::__construct(): <movie><test x="2">movie 2</test></movie> in /in/XrgLA on line 10 Warning: SimpleXMLElement::__construct(): ^ in /in/XrgLA on line 10 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/XrgLA:10 Stack trace: #0 /in/XrgLA(10): SimpleXMLElement->__construct('<?xml version='...') #1 {main} thrown in /in/XrgLA on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.5
Warning: SimpleXMLElement::__construct(): Entity: line 4: parser error : Premature end of data in tag movies line 2 in /in/XrgLA on line 10 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/XrgLA:10 Stack trace: #0 /in/XrgLA(10): SimpleXMLElement->__construct('<?xml version='...') #1 {main} thrown in /in/XrgLA on line 10
Process exited with code 255.
Output for 5.1.0 - 5.1.1, 5.1.3 - 5.5.28, 5.5.35 - 5.6.12, 5.6.21 - 5.6.28
Warning: SimpleXMLElement::__construct(): Entity: line 4: parser error : Premature end of data in tag movies line 2 in /in/XrgLA on line 10 Warning: SimpleXMLElement::__construct(): <movie><test x="2">movie 2</test></movie> in /in/XrgLA on line 10 Warning: SimpleXMLElement::__construct(): ^ in /in/XrgLA on line 10 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/XrgLA:10 Stack trace: #0 /in/XrgLA(10): SimpleXMLElement->__construct('<?xml version='...') #1 {main} thrown in /in/XrgLA on line 10
Process exited with code 255.
Output for 5.5.29 - 5.5.34, 5.6.13 - 5.6.20
Warning: SimpleXMLElement::__construct(): Entity: line 4: parser error : Premature end of data in tag movies line 2 in /in/XrgLA on line 10 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/XrgLA:10 Stack trace: #0 /in/XrgLA(10): SimpleXMLElement->__construct('<?xml version='...') #1 {main} thrown in /in/XrgLA on line 10
Process exited with code 255.
Output for 5.1.2
Warning: SimpleXMLElement::__construct(): Entity: line 4: parser error : Premature end of data in tag movies line 2 in /in/XrgLA on line 11 Warning: SimpleXMLElement::__construct(): <movie><test x="2">movie 2</test></movie> in /in/XrgLA on line 11 Warning: SimpleXMLElement::__construct(): ^ in /in/XrgLA on line 11 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/XrgLA:11 Stack trace: #0 /in/XrgLA(11): SimpleXMLElement->__construct('<?xml version='...') #1 {main} thrown in /in/XrgLA on line 11
Process exited with code 255.
Output for 5.0.3 - 5.0.5
Warning: Entity: line 4: parser error : Premature end of data in tag movies line 2 in /in/XrgLA on line 10 Warning: <movie><test x="2">movie 2</test></movie> in /in/XrgLA on line 10 Warning: ^ in /in/XrgLA on line 10 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/XrgLA:10 Stack trace: #0 /in/XrgLA(10): SimpleXMLElement->__construct('<?xml version='...') #1 {main} thrown in /in/XrgLA on line 10
Process exited with code 255.
Output for 5.0.0 - 5.0.2
Warning: Entity: line 4: parser error : Premature end of data in tag movies line 2 in /in/XrgLA on line 10 Warning: <movie><test x="2">movie 2</test></movie> in /in/XrgLA on line 10 Warning: ^ in /in/XrgLA on line 10 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/XrgLA:10 Stack trace: #0 {main} thrown in /in/XrgLA on line 10
Process exited with code 255.
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.9
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/XrgLA on line 10
Process exited with code 255.
Output for 4.4.2
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/XrgLA on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/XrgLA on line 10