[ create a new paste ] login | about

Link: http://codepad.org/JjrMnaQ5    [ raw code | output | fork ]

PHP, pasted on Nov 28:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
$xmlstring = <<<XML
<?xml version="1.0" encoding="iso-8859-1" ?>
<tarification compagnie="banane" cle="laclef">
<gamme reference="equilibre-sante">
<tarif formule="f100">Xx.xx</tarif>
<tarif formule="f200">Xx.xx</tarif>
</gamme>
</tarification>
XML;
 
$xml = simplexml_load_string($xmlstring);
                                                                                                                                                                                                               
foreach($xml->gamme->tarif as $tarif) {
        foreach($tarif->attributes() as $a => $b) {
                echo $a,'="',$b,"\"\n";
        }
}
 
?>


Output:
1
2
formule="f100"
formule="f200"


Create a new paste based on this one


Comments: