Код: Выделить всё
if (isset($this->contents[$products_id])) {
Код: Выделить всё
Cannot access offset of type array in isset or empty
Код: Выделить всё
class shoppingCart {
public ?array $contents = null;
function get_quantity($products_id) {
if (isset($this->contents[$products_id])) {
return $this->contents[$products_id]['qty'];
} else {
return 0;
}
}
}
Спасибо за любые мысли!
п>
Подробнее здесь: https://stackoverflow.com/questions/791 ... onal-array
Мобильная версия