If the item is at the front of the array, array_shift() will do it.
If not, you might look at array_pop, and there's some other one....I forget the name.
I just ended up writing the following:
function compact_cart() {
if ($_SESSION['cart']) {
for ($y=20; $y>0; $y--) {
$x=($y-1);
if (((empty($_SESSION['cart'][$x]) || (!($_SESSION // watch cont...
['cart'][$x])))) && ($_SESSION['cart'][$y])){
$_SESSION['cart'][$x]=$_SESSION['cart'][$y];
unset($_SESSION['cart'][$y]);
}
}
}}
Works for carts up to 20 items, per the loop. A real ugly kludge, but I was REAL new at this at the time. Haven't thought about rewriting either...not that I'm not still a virtual noobie.... 🙂