Forum Moderators: coopster
I have 6 elements in my indexed array, the code displays the first 4 elements correctly, it then displays a number '2' or a number '6' for the 5th element (that's not in the array) and it displays the real 5th element in position 6 and the last element never gets echo'd!
$_SESSION['cart'][] = array(
1 => $style, $width, $height, $price, $position, $open);
foreach($_SESSION['cart'] as $cart_items)
{
for ($i = 0; $i < count($cart_items); $i++) {
echo $cart_items[$i];
}
}
1st element (0) $var correct value
2nd element (1) $var correct value
3rd element (2) $var correct value
4th element (3) $var correct value
5th element (4) echos the strange number "2"
6th element (5) echos the value of the variable stored at the 5th element (4).
The value of the 6th element (5) never gets echo'd