3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xmlstr='<mainGroup> <groupHeading type="heading">This is a sample heading</groupHeading> <group type="groupType1"> <title>Title1</title> <date when="0001"></date> </group> <group type="groupType1"> <title>Title2</title> <date when="0002"></date> </group> <group type="groupType2"> <title>Title3</title> <date when="0003"></date> </group> </mainGroup>'; $xml=simplexml_load_file($xmlstr); // now loop through all <groupheading>, we use an xpath-query... foreach ($xml->xpath("//groupheading") as $gh) { echo $gh; } ?>
Output for 7.0.0 - 7.2.0
Warning: simplexml_load_file(): I/O warning : failed to load external entity "<mainGroup> <groupHeading type="heading">This is a sample heading</groupHeading> <group type="groupType1"> <title>Title1</title> <date when="0001"></date> </group> <group type="groupType1"> <title>Title2</title> <date when="0002"></date> </group> <group type="groupType2"> <title>Title3</title> <date when="0003"></date> </group> </mainGroup>" in /in/1Xvbp on line 20 Fatal error: Uncaught Error: Call to a member function xpath() on boolean in /in/1Xvbp:24 Stack trace: #0 {main} thrown in /in/1Xvbp on line 24
Process exited with code 255.
Output for 5.6.7 - 5.6.28
Warning: simplexml_load_file(): I/O warning : failed to load external entity "<mainGroup> <groupHeading type="heading">This is a sample heading</groupHeading> <group type="groupType1"> <title>Title1</title> <date when="0001"></date> </group> <group type="groupType1"> <title>Title2</title> <date when="0002"></date> </group> <group type="groupType2"> <title>Title3</title> <date when="0003"></date> </group> </mainGroup>" in /in/1Xvbp on line 20 Fatal error: Call to a member function xpath() on boolean in /in/1Xvbp on line 24
Process exited with code 255.
Output for 5.1.0 - 5.5.35
Warning: simplexml_load_file(): I/O warning : failed to load external entity "<mainGroup> <groupHeading type="heading">This is a sample heading</groupHeading> <group type="groupType1"> <title>Title1</title> <date when="0001"></date> </group> <group type="groupType1"> <title>Title2</title> <date when="0002"></date> </group> <group type="groupType2"> <title>Title3</title> <date when="0003"></date> </group> </mainGroup>" in /in/1Xvbp on line 20 Fatal error: Call to a member function xpath() on a non-object in /in/1Xvbp on line 24
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Warning: I/O warning : failed to load external entity "<mainGroup> <groupHeading type="heading">This is a sample heading</groupHeading> <group type="groupType1"> <title>Title1</title> <date when="0001"></date> </group> <group type="groupType1"> <title>Title2</title> <date when="0002"></date> </group> <group type="groupType2"> <title>Title3</title> <date when="0003"></date> </group> </mainGroup>" in /in/1Xvbp on line 20 Fatal error: Call to a member function xpath() on a non-object in /in/1Xvbp on line 24
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_file() in /in/1Xvbp on line 20
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: simplexml_load_file() in /in/1Xvbp on line 20
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_file() in /in/1Xvbp on line 20