[ create a new paste ] login | about

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

PHP, pasted on Oct 4:
<?php
$string="
<result>
    <item>
        <id>1</id>
        <name>name 1</name>
    </item>
    <item>
        <id>2</id>
        <name>name 1</name>
    </item>

</result>";

$xml = simplexml_load_string($string);

//print_r($xml);


foreach($xml->item as $item)
{
echo $item->id."\n";
}

?>


Output:
1
2
1
2


Create a new paste based on this one


Comments: