3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlstr = <<<XML <medium val="organic"> <source val=""> <campaign val=""> <lever3 val="seo" /> <lever2 val="seo" /> <lever1 val="trafic_gratuit" /> </campaign> </source> </medium> <medium val="cpa"> <source val="affilinet"> <campaign val=""> <lever3 val="affiliation" /> <lever2 val="affiliation" /> <lever1 val="trafic_payant" /> </campaign> </source> </medium> <!-- ETC --> XML; $xml = new SimpleXMLElement($xmlstr); $res = $xml->xpath("/medium/atribute::cpa"); while(list( , $node) = each($res)) { echo '/a/b/c: ',$node,"\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: SimpleXMLElement::__construct(): Entity: line 11: parser error : Extra content at the end of the document in /in/WMnp1 on line 25 Warning: SimpleXMLElement::__construct(): <medium val="cpa"> in /in/WMnp1 on line 25 Warning: SimpleXMLElement::__construct(): ^ in /in/WMnp1 on line 25 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/WMnp1:25 Stack trace: #0 /in/WMnp1(25): SimpleXMLElement->__construct(' <medium val...') #1 {main} thrown in /in/WMnp1 on line 25
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:
36.2 ms | 401 KiB | 8 Q