使用动态变量的非法偏移

I dont unserstand why do i get such errors:

Warning: Illegal offset type in .../index.php on line 10 USD 1.4141

Warning: Illegal offset type in .../index.php on line 10 JPY 118.56

Here's my code:

<?php
$xml = simplexml_load_file("eurofxref-daily.xml");
$array=array();
foreach ($xml->children() as $cubeMain) {
    foreach ($cubeMain->children() as $cubeTime) {
        echo "Time: " . $cubeTime['time'];
        foreach ($cubeTime->children() as $cubeCurr) {
            $currency=$cubeCurr['currency'];
            $rate=$cubeCurr['rate'];
            $array = array($currency => $rate);
            echo $currency . "&nbsp;" . $rate . "<br />";
        }
    }
}
?>

Use $array = array((string)$currency => $rate);.

SimpleXML returns objects, not strings - and while they have proper __toString methods, PHP doesn't use them when these objects are used as an array index.