3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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/*"); $i =0; foreach ($x as $elt){ echo ++$i . "curent::".$elt.", attributes::".$elt->attributes().", test ancestor::".$elt/ancestors-or-self::source[1]."\n"; }
Output for 5.4.0 - 5.4.20
Parse error: syntax error, unexpected 'or' (T_LOGICAL_OR) in /in/AbLdj on line 37
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_LOGICAL_OR in /in/AbLdj on line 37
Process exited with code 255.