SimpleXMLElement value to int
<p>I have problem with SimpleXMLElement.
This is var_dump one of my SimpleXML position:</p>

<pre><code>object(SimpleXMLElement)#42 (4) 
{ 
    ["nazwa_waluty"] =&gt; string(14) "rubel rosyjski" 
    ["przelicznik"]  =&gt; string(1)  "1" 
    ["kod_waluty"]   =&gt; string(3)  "RUB" 
    ["kurs_sredni"]  =&gt; string(6)  "0,0514" 
}
</code></pre>

<p>and I don't know how to get "kurs_sredni" as an intiger.<br>
I tried <code>(int) $position-&gt;kurs_sredni</code> but it doesn't work.<br>
Any suggestions?</p>

<p>EDIT:
This is my method. I would like to get "kurs_sredni" as a float:</p>

<pre><code>public function getExchangeRate($currency)
    {
        $filename = 'LastA.xml';
        $filepath = Mage::getBaseDir('base') . '/media/exchangerate/' . $filename;
        $exchangeRateXml = simplexml_load_file($filepath);

        foreach($exchangeRateXml-&gt;pozycja as $position){
            if ($position-&gt;kod_waluty == $currency) {
                var_dump((float) $position-&gt;kurs_sredni);die();
            }
        }
    }
</code></pre>

<p>and var_dump returns 0</p>