3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = <<<XML <xml> <medium val="idealo"> <source val=""> <campaign val=""> <lever3 val="comparateur-idealo" /> <lever2 val="comparateur" /> <lever1 val="trafic_payant" /> </campaign> </source> </medium> <medium val="partaenaire"> <source val=""> <campaign val=""> <lever3 val="partenariat" /> <lever2 val="partenariat" /> <lever1 val="trafic_gratuit" /> </campaign> </source> <source val="magasinauchan"> <campaign val=""> <lever3 val="partenaire_hypers" /> <lever2 val="partenaires_hypers" /> <lever1 val="hypers" /> </campaign> </source> </medium> </xml> XML; $xml = simplexml_load_string($str); $x = $xml->xpath("//campaign//"); foreach ($x as $elt){ echo "array(\"" . $x[$i][0]->attributes() . "\", \"" . $x[$i+1][0]->attributes() . "\", \"" . $x[$i+2][0]->attributes() . "\")," . "<br/>"; }
Output for git.master, git.master_jit
Warning: SimpleXMLElement::xpath(): Invalid expression in /in/W09X0 on line 34 Warning: SimpleXMLElement::xpath(): xmlXPathEval: evaluation failed in /in/W09X0 on line 34 Warning: foreach() argument must be of type array|object, bool given in /in/W09X0 on line 36
Output for rfc.property-hooks
Warning: SimpleXMLElement::xpath(): Invalid expression in /in/W09X0 on line 34 Warning: SimpleXMLElement::xpath(): xmlXPathEval: evaluation failed in /in/W09X0 on line 34 Warning: foreach() argument must be of type array|object, false given in /in/W09X0 on line 36

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:
69.06 ms | 401 KiB | 8 Q