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); $results = $xml->xpath("//medium[@val='cpa']/source[@val='affilinet']/campaign[@val='']/*"); foreach ($results as $result) { echo "{$result} => {$result->attributes()}\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
=> affiliation => affiliation => trafic_payant

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