Hi there. I'm creating an online shopping cart. The products, are references to a database. The References are stored in a session variable called $cartcontents
The only problem I have is when a user removes an item from the cart. I can't remove the product reference number from the array without disrupting other values?
For example:
$array = array("514","5562","3435","134","9335");
How would I remove the value "134" out of this array?
I tried to work it out for myself, and I found the function array_search(). This searches for the value in the array, and returns the index number.
So if I want to get the index of the value "134" in the array:
$index = array_search("134", $array);
But how do I remove it?
Please help,
Stephen.