Возникает ошибка Warning: Illegal string offset 'code'
protected $currencies;
protected $currency;
public static function getCurrencies(){
return \R::getAssoc("SELECT code, title, symbol_left, symbol_right, value, base FROM currency ORDER BY base DESC");
}
public static function getCurrency($currencies){
if(isset($_COOKIE['currency']) && array_key_exists($_COOKIE['currency'], $currencies)){
$key = $_COOKIE['currency'];
}else{
$key = key($currencies);
}
$currency = $currencies[$key];
$currency['code'] = $key;
return $currency;
}
Вот строчка из-за которой выскакивает предупреждение:
$currency['code'] = $key;