$i starts at 0 ($i = 0). Increases by 1 every time it loops ($i++), and stops when it’s no longer smaller than the number of items in the cart ($i < $_SESSION[‘SHOP’]->Get_Size()
So the first item gets put into $productcodeid[0], the second into $productcodeid[1], etc…
just says to me that whatever’s in $_SESSION[‘SHOP’] is an object with a Get_Size function defined.
Barnes’ output suggests that at some point after the end of the loop, $productcodeid gets overwritten with a singular value, or the get_ID method is returning a single integer.
So, is GET_ID() returning the whole number or are you echoing it incorrectly?
Just start echoing the values onto the page and check them carefully.
for ($i = 0; $i < $_SESSION['SHOP']->Get_Size(); $i++) {
// check the values are extracted from the object in the SESSION
echo $_SESSION['SHOP']->items[$i]->Get_ID();
$productcodeid[$i] = $_SESSION['SHOP']->items[$i]->Get_ID();
}
// then check whether the values made it into the array
var_dump( $productcodeid );