Xml
<CRates>
<Currencies>
<Currency>
<ID>AED</ID>
<Units>1</Units>
<Rate>0.17200000</Rate>
</Currency>
<Currency>
<ID>ATS</ID>
<Units>1</Units>
<Rate>0.04102750</Rate>
</Currency>
</Currencies>
</CRates>
Want to get for example Rate value where ID is ATS
At the moment can get only in such way
$xmlDoc = simplexml_load_file('__joomla.xml');
echo $xmlDoc->Currencies->Currency[1]->Rate;
<ID>ATS</ID> is within the second <Currency>, so Currency[1]
Of course echo $xmlDoc->Currencies->Currency[ATS]->Rate; does not work. But is any simple way to get it work?
Seems need to use foreach and inside foreach if <ID> == ATS, echo <Rate>
<Rate>of<Currency>where<ID>matches set condition. For example, user wants to see Rate for currency ATS. So need to show the Rate only for currency ATS