<?xml version="1.0"?>
<catalog version="1.0" date="2016-06-03 03:20"><shop>
<name>111111111111</name>
<currencies>
<currency id="RUR" rate="1" />
<currency id="USD" rate="42" />
<currency id="EUR" rate="53" />
</currencies>
</shop></catalog>
Вот код php файла
$xml = simplexml_load_file('catalog.xml');
foreach ($xml as $info) {
echo $info;
}
Выводит пустое окно.
print_r($xml); выводит вот что:
SimpleXMLElement Object ( [@attributes] => Array ( [version] => 1.0 [date] => 2016-06-03 03:20 ) [shop] => SimpleXMLElement Object ( [name] => 111111111111 [currencies] => SimpleXMLElement Object ( [currency] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => RUR [rate] => 1 ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => USD [rate] => 42 ) ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => EUR [rate] => 53 ) ) ) ) ) )
Не пойму, как мне вывести например все значения в теге currencies хмл файла?