3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit
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 bool in /in/1Xvbp:24 Stack trace: #0 {main} thrown in /in/1Xvbp on line 24
Process exited with code 255.
Output for rfc.property-hooks
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 false in /in/1Xvbp:24 Stack trace: #0 {main} thrown in /in/1Xvbp on line 24
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
59.29 ms | 401 KiB | 8 Q