3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlstr = <<<XML <xml> <medium val="organic"> <source val=""> <campaign val=""> <lever3 val="seo">foo</lever3> <lever2 val="seo">bar</lever2> <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> </xml> XML; $xml = new SimpleXMLElement($xmlstr); $res = $xml->xpath("//medium/"); foreach($res[0]->attributes() as $val) { echo "val:: {$val}.\n"; }
Output for git.master, git.master_jit
Warning: SimpleXMLElement::xpath(): Invalid expression in /in/ROjmi on line 28 Warning: SimpleXMLElement::xpath(): xmlXPathEval: evaluation failed in /in/ROjmi on line 28 Warning: Trying to access array offset on value of type bool in /in/ROjmi on line 30 Fatal error: Uncaught Error: Call to a member function attributes() on null in /in/ROjmi:30 Stack trace: #0 {main} thrown in /in/ROjmi on line 30
Process exited with code 255.
Output for rfc.property-hooks
Warning: SimpleXMLElement::xpath(): Invalid expression in /in/ROjmi on line 28 Warning: SimpleXMLElement::xpath(): xmlXPathEval: evaluation failed in /in/ROjmi on line 28 Warning: Trying to access array offset on false in /in/ROjmi on line 30 Fatal error: Uncaught Error: Call to a member function attributes() on null in /in/ROjmi:30 Stack trace: #0 {main} thrown in /in/ROjmi on line 30
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:
49.45 ms | 401 KiB | 8 Q