How can I just obtain the string value of a Xml node using xpath in PHP? I RTFM but there is more complicated situations, using foreach I want just my node text. XML:
<ValCurs Date="00.00.0000" name="Official exchange rate">
<Valute ID="47">
<NumCode>978</NumCode>
<CharCode>EUR</CharCode>
<Nominal>1</Nominal>
<Name>Euro</Name>
<Value>17.4619</Value>
</Valute>
</ValCurs>
what I do:
$xmlToday = simplexml_load_file($urlToday);
$EurToday = $xmlToday->xpath("/ValCurs/Valute[@ID='47']/Value");
$EurToday = array(1) { [0]=> object(SimpleXMLElement)#3 (1) { [0]=> string(7) "17.4619" } }
I need the value only. As a floating value.