simplexml_load_string 解析不正确

simplexml_load_string doesn't parse right

所以,我正在尝试解析 xml 并从中获取一些值:

    $xml = simplexml_load_string(file_get_contents('http://www.bnr.ro/nbrfxrates.xml'));
    $currency = [];

    foreach($xml->Body->Cube->Rate as $rate)
    {
        $currency[] = [
            "name" => $rate["currency"],
            "value" => $rate,
            "multiplier" => $rate["multiplier"]
        ];
    }

    return $currency;

我的 $rate 变量应该是 Rate 标签内的值(例如:1.0806),而不是它给我这个:

object(SimpleXMLElement)[110]
   public '@attributes' => 
      array (size=1)
         'currency' => string 'AED' (length=3)

将 $rate 转换为(字符串)将起作用:

    $currency[] = [
        "name" => $rate["currency"],
        "value" => (string)$rate,
        "multiplier" => $rate["multiplier"]
    ];