У меня есть следующий код, и он сводит меня с ума ..
echo $this->year; //This echoes 2019
return $set_year[2019]; //This works, it returns the expected value
return $set_year[$this->year]; //This returns nothing and gives me an 'Undefined Index'
Что здесь происходит? Вот как я устанавливаю массив:
return [
'years' => [
2019 => 7,
2018 => 8,
2017 => 9,
2016 => 10,
2015 => 11,
2014 => 12,
2013 => 13,
],
];