Есть вот такой файл к xml
<currency_list>
<USD sel="48.75" buy="49.75"/>
<EUR sel="54.75" buy="56.00"/>
<GBP sel="" buy=""/>
<time time="1458"/>
</currency_list>
Как мне вывести исключительно число 1458? Пытаюсь так:
$xml = simplexml_load_file('/currency.xml');
print_r($xml);
тогда выводится
SimpleXMLElement Object ( [USD] => SimpleXMLElement Object ( [@attributes] => Array ( [sel] => 48.75 [buy] => 49.75 ) ) [EUR] => SimpleXMLElement Object ( [@attributes] => Array ( [sel] => 54.75 [buy] => 56.00 ) ) [GBP] => SimpleXMLElement Object ( [@attributes] => Array ( [sel] => [buy] => ) ) [time] => SimpleXMLElement Object ( [@attributes] => Array ( [time] => 1458 ) ) )
Если
print_r($xml->currency_list); //выводится SimpleXMLElement Object ( )
а если
print_r($xml->time); //SimpleXMLElement Object ( [@attributes] => Array ( [time] => 1458 ) )
и как мне вывести только 1458?