> I am just learning to use objects. I am messing around with a shopping
cart
> object, but am having confusing problems. I am getting an undefined index
> error when trying to assign a key value pair to an array variable within
an
> object. I am confused becuase I believe this is how you assign ar
> foreach ($cart as $product_id => $quantity)
> {
> echo $product_id . "" . $quantity;
> }
The way you are accessing the array is incorrect. The $items array is a
property of the Cart object. Since the Cart object may have many different
array properties, the foreach statement above has to be
2 matches
Mail list logo