3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xmlstr = <<<XML <xml> <medium val="cpa"> <source val="affilinet"> <campaign val=""> <lever3 val="affiliation" /> <lever2 val="affiliation" /> <lever1 val="trafic_payant" /> </campaign> </source> </medium> <medium val="cpc"> <!-- uncomplete --> <source val=""> <campaign val="remarketing"> <lever3 val="sem-remarketing" /> <lever2 val="sem" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="bing"> <campaign val="auchan-fil_rouge"> <lever3 val="sem-marque-yahoo_bing" /> <lever2 val="sem" /> <lever1 val="trafic_payant" /> </campaign> <campaign val="marque"> <lever3 val="sem-marque-yahoo_bing"/> <lever2 val="sem" /> <lever1 val="trafic_payant" /> </campaign> <campaign val="horsmarque"> <!-- FIXME --> <lever3 val="sem-horsmarque-yahoo_bing"/> <lever2 val="sem" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="leguide"> <campaign val=""> <lever3 val="comparateur-leguide" /> <lever2 val="comparateur" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="google"> <campaign val="marque"> <lever3 val="sem-marque-google" /> <lever2 val="sem" /> <lever1 val="trafic_payant" /> </campaign> ` <campaign val="auchan-fil_rouge"> <lever3 val="sem-marque-google" /> <lever2 val="sem" /> <lever1 val="trafic_payant" /> </campaign> <campaign val="horsmarque"> <lever3 val="sem-hors-marque-google" /> <lever2 val="sem" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="google.shopping"> <campaign val=""> <lever3 val="comparateur-google_shopping" /> <lever2 val="comparateur" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="cherchons"> <campaign val=""> <lever3 val="comparateur-cherchons" /> <lever2 val="comparateur" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="shopping.cherchons.com"> <campaign val=""> <lever3 val="comparateur-cherchons" /> <lever2 val="comparateur" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="twenga"> <campaign val=""> <lever3 val="comparateur-twenga" /> <lever2 val="comparateur" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="achetezfacile"> <campaign val=""> <lever3 val="comparateur-achetez_facile" /> <lever2 val="comparateur" /> <lever1 val="trafic_payant" /> </campaign> </source> </medium> <medium val="organic"> <source val=""> <campaign val=""> <lever3 val="seo" /> <lever2 val="seo" /> <lever1 val="trafic_gratuit" /> </campaign> </source> </medium> <medium val="display"> <source val=""> <campaign val=""> <lever3 val="display" /> <lever2 val="display" /> <lever1 val="trafic_payant" /> </campaign> </source> </medium> <medium val="email"> <source val="newsletteraecf"> <campaign val=""> <lever3 val="email-auchanfr" /> <lever2 val="email_auchanfr" /> <lever1 val="email_auchanfr" /> </campaign> </source> <source val="magasinauchan"> <campaign val=""> <lever3 val="email_hypers" /> <lever2 val="partenaires_hypers" /> <lever1 val="hypers" /> </campaign> </source> </medium> <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> <medium val="referral"> <source val="go.leguide.com"> <campaign val=""> <lever3 val="comparateur-leguide" /> <lever2 val="comparateur" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="webmarchand.com"> <campaign val=""> <lever3 val="comparateur-leguide" /> <lever2 val="comparateur" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="choozen.fr"> <campaign val=""> <lever3 val="comparateur-leguide" /> <lever2 val="comparateur" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="r.twenga.fr"> <campaign val=""> <lever3 val="comparateur-twenga" /> <lever2 val="comparateur" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="twenga.fr"> <campaign val=""> <lever3 val="comparateur-twenga" /> <lever2 val="comparateur" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val=""> <campaign val=""> <lever3 val="referents_externes" /> <lever2 val="referents_externes" /> <lever1 val="trafic_gratuit" /> </campaign> </source> </medium> <medium val="retargeting"> <source val="mythings"> <campaign val=""> <lever3 val="retargeting-mythings" /> <lever2 val="retargeting" /> <lever1 val="trafic_payant" /> </campaign> </source> <source val="eperflex"> <campaign val=""> <lever3 val="retargeting-eperflex" /> <lever2 val="retargeting" /> <lever1 val="trafic_payant" /> </campaign> </source> </medium> <medium val="rtb"> <source val=""> <campaign val=""> <lever3 val="forfait_rtb" /> <lever2 val="rtb" /> <lever1 val="trafic_payant" /> </campaign> </source> </medium> <medium val=""> <source val=""> <campaign val=""> <lever3 val="acces_direct" /> <lever2 val="acces_direct" /> <lever1 val="trafic_gratuit" /> </campaign> </source> </medium> </xml> XML; $xml = simplexml_load_string($xmlstr); $x = $xml->xpath("//campaign/*"); for ($i = 0; $i <= count($x); $i += 3) { echo "array(\"" . $x[$i][0]->attributes() . "\", \"" . $x[$i+1][0]->attributes() . "\", \"" . $x[$i+2][0]->attributes() . "\")," . "\n"; } //$levers = array(array("comparateur-google_shopping", "comparateur", "trafic_payant"), // array("display", "display", "trafic_payant"), // array("email-auchanfr", "email_auchanfr", "email_auchanfr") // ); //$begin = 41; //$end = 50; //for ($i = $begin; $i <= $end; ++$i){ // $index = rand(0,2); // $query = "UPDATE IGNORE piwik_log_visit SET lever3='" . $levers[$index][0] . "', lever2='" . $levers[$index][1] . "', lever1='" . //$levers[$index][2] . "' WHERE idvisit=" . $i . ";"; // echo $query . "\n"; //} //print_r($levers[rand(0,2)]);
Output for 7.0.0 - 7.1.0
array("affiliation", "affiliation", "trafic_payant"), array("sem-remarketing", "sem", "trafic_payant"), array("sem-marque-yahoo_bing", "sem", "trafic_payant"), array("sem-marque-yahoo_bing", "sem", "trafic_payant"), array("sem-horsmarque-yahoo_bing", "sem", "trafic_payant"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("sem-marque-google", "sem", "trafic_payant"), array("sem-marque-google", "sem", "trafic_payant"), array("sem-hors-marque-google", "sem", "trafic_payant"), array("comparateur-google_shopping", "comparateur", "trafic_payant"), array("comparateur-cherchons", "comparateur", "trafic_payant"), array("comparateur-cherchons", "comparateur", "trafic_payant"), array("comparateur-twenga", "comparateur", "trafic_payant"), array("comparateur-achetez_facile", "comparateur", "trafic_payant"), array("seo", "seo", "trafic_gratuit"), array("display", "display", "trafic_payant"), array("email-auchanfr", "email_auchanfr", "email_auchanfr"), array("email_hypers", "partenaires_hypers", "hypers"), array("comparateur-idealo", "comparateur", "trafic_payant"), array("partenariat", "partenariat", "trafic_gratuit"), array("partenaire_hypers", "partenaires_hypers", "hypers"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("comparateur-twenga", "comparateur", "trafic_payant"), array("comparateur-twenga", "comparateur", "trafic_payant"), array("referents_externes", "referents_externes", "trafic_gratuit"), array("retargeting-mythings", "retargeting", "trafic_payant"), array("retargeting-eperflex", "retargeting", "trafic_payant"), array("forfait_rtb", "rtb", "trafic_payant"), array("acces_direct", "acces_direct", "trafic_gratuit"), Notice: Undefined offset: 93 in /in/teJoW on line 245 Fatal error: Uncaught Error: Call to a member function attributes() on null in /in/teJoW:245 Stack trace: #0 {main} thrown in /in/teJoW on line 245
Process exited with code 255.
Output for 5.6.0 - 5.6.28
array("affiliation", "affiliation", "trafic_payant"), array("sem-remarketing", "sem", "trafic_payant"), array("sem-marque-yahoo_bing", "sem", "trafic_payant"), array("sem-marque-yahoo_bing", "sem", "trafic_payant"), array("sem-horsmarque-yahoo_bing", "sem", "trafic_payant"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("sem-marque-google", "sem", "trafic_payant"), array("sem-marque-google", "sem", "trafic_payant"), array("sem-hors-marque-google", "sem", "trafic_payant"), array("comparateur-google_shopping", "comparateur", "trafic_payant"), array("comparateur-cherchons", "comparateur", "trafic_payant"), array("comparateur-cherchons", "comparateur", "trafic_payant"), array("comparateur-twenga", "comparateur", "trafic_payant"), array("comparateur-achetez_facile", "comparateur", "trafic_payant"), array("seo", "seo", "trafic_gratuit"), array("display", "display", "trafic_payant"), array("email-auchanfr", "email_auchanfr", "email_auchanfr"), array("email_hypers", "partenaires_hypers", "hypers"), array("comparateur-idealo", "comparateur", "trafic_payant"), array("partenariat", "partenariat", "trafic_gratuit"), array("partenaire_hypers", "partenaires_hypers", "hypers"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("comparateur-twenga", "comparateur", "trafic_payant"), array("comparateur-twenga", "comparateur", "trafic_payant"), array("referents_externes", "referents_externes", "trafic_gratuit"), array("retargeting-mythings", "retargeting", "trafic_payant"), array("retargeting-eperflex", "retargeting", "trafic_payant"), array("forfait_rtb", "rtb", "trafic_payant"), array("acces_direct", "acces_direct", "trafic_gratuit"), Notice: Undefined offset: 93 in /in/teJoW on line 245 Fatal error: Call to a member function attributes() on null in /in/teJoW on line 245
Process exited with code 255.
Output for 5.3.0 - 5.5.38
array("affiliation", "affiliation", "trafic_payant"), array("sem-remarketing", "sem", "trafic_payant"), array("sem-marque-yahoo_bing", "sem", "trafic_payant"), array("sem-marque-yahoo_bing", "sem", "trafic_payant"), array("sem-horsmarque-yahoo_bing", "sem", "trafic_payant"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("sem-marque-google", "sem", "trafic_payant"), array("sem-marque-google", "sem", "trafic_payant"), array("sem-hors-marque-google", "sem", "trafic_payant"), array("comparateur-google_shopping", "comparateur", "trafic_payant"), array("comparateur-cherchons", "comparateur", "trafic_payant"), array("comparateur-cherchons", "comparateur", "trafic_payant"), array("comparateur-twenga", "comparateur", "trafic_payant"), array("comparateur-achetez_facile", "comparateur", "trafic_payant"), array("seo", "seo", "trafic_gratuit"), array("display", "display", "trafic_payant"), array("email-auchanfr", "email_auchanfr", "email_auchanfr"), array("email_hypers", "partenaires_hypers", "hypers"), array("comparateur-idealo", "comparateur", "trafic_payant"), array("partenariat", "partenariat", "trafic_gratuit"), array("partenaire_hypers", "partenaires_hypers", "hypers"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("comparateur-twenga", "comparateur", "trafic_payant"), array("comparateur-twenga", "comparateur", "trafic_payant"), array("referents_externes", "referents_externes", "trafic_gratuit"), array("retargeting-mythings", "retargeting", "trafic_payant"), array("retargeting-eperflex", "retargeting", "trafic_payant"), array("forfait_rtb", "rtb", "trafic_payant"), array("acces_direct", "acces_direct", "trafic_gratuit"), Notice: Undefined offset: 93 in /in/teJoW on line 245 Fatal error: Call to a member function attributes() on a non-object in /in/teJoW on line 245
Process exited with code 255.
Output for 5.2.2 - 5.2.17
array("affiliation", "affiliation", "trafic_payant"), array("sem-remarketing", "sem", "trafic_payant"), array("sem-marque-yahoo_bing", "sem", "trafic_payant"), array("sem-marque-yahoo_bing", "sem", "trafic_payant"), array("sem-horsmarque-yahoo_bing", "sem", "trafic_payant"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("sem-marque-google", "sem", "trafic_payant"), array("sem-marque-google", "sem", "trafic_payant"), array("sem-hors-marque-google", "sem", "trafic_payant"), array("comparateur-google_shopping", "comparateur", "trafic_payant"), array("comparateur-cherchons", "comparateur", "trafic_payant"), array("comparateur-cherchons", "comparateur", "trafic_payant"), array("comparateur-twenga", "comparateur", "trafic_payant"), array("comparateur-achetez_facile", "comparateur", "trafic_payant"), array("seo", "seo", "trafic_gratuit"), array("display", "display", "trafic_payant"), array("email-auchanfr", "email_auchanfr", "email_auchanfr"), array("email_hypers", "partenaires_hypers", "hypers"), array("comparateur-idealo", "comparateur", "trafic_payant"), array("partenariat", "partenariat", "trafic_gratuit"), array("partenaire_hypers", "partenaires_hypers", "hypers"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("comparateur-leguide", "comparateur", "trafic_payant"), array("comparateur-twenga", "comparateur", "trafic_payant"), array("comparateur-twenga", "comparateur", "trafic_payant"), array("referents_externes", "referents_externes", "trafic_gratuit"), array("retargeting-mythings", "retargeting", "trafic_payant"), array("retargeting-eperflex", "retargeting", "trafic_payant"), array("forfait_rtb", "rtb", "trafic_payant"), array("acces_direct", "acces_direct", "trafic_gratuit"), Notice: Undefined offset: 93 in /in/teJoW on line 245 Fatal error: Call to a member function attributes() on a non-object in /in/teJoW on line 245
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.1, 5.1.3 - 5.2.1
Fatal error: Call to a member function attributes() on a non-object in /in/teJoW on line 245
Process exited with code 255.
Output for 5.1.2
Fatal error: Call to a member function attributes() on a non-object in /in/teJoW on line 246
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/teJoW on line 262
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_string() in /in/teJoW on line 239
Process exited with code 255.
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.4
Fatal error: Call to undefined function: simplexml_load_string() in /in/teJoW on line 239
Process exited with code 255.
Output for 4.4.2
Fatal error: Call to undefined function: simplexml_load_string() in /in/teJoW on line 240
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_string() in /in/teJoW on line 239