[ create a new paste ] login | about

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

PHP, pasted on Dec 11:
<?php

$xml = '<Match ct="0" id="771597" LastPeriod="2 HF" LeagueCode="19984" LeagueSort="1" LeagueType="LEAGUE" startTime="15:00" status="2 HF" statustype="live" type="2" visible="1">
    <Home id="11676" name="Manchester City" standing="1"/>
    <Away id="10826" name="Newcastle United" standing="3"/>
    <Results>
        <Result id="1" name="CURRENT" value="1-1"/>
        <Result id="2" name="FT" value="1-1"/>
        <Result id="3" name="HT" value="1-0"/>
    </Results>
    <Information>
        <league id="19984">Premier League</league>
        <note/>
        <bitarray/>
        <timestamp/>
    </Information>
</Match>';

$obj = simplexml_load_string($xml);

foreach($obj->Results->Result as $result)
{
    echo $result->attributes()->name . ': ' . $result->attributes()->value . "\n";
}


Output:
1
2
3
CURRENT: 1-1
FT: 1-1
HT: 1-0


Create a new paste based on this one


Comments: