remove an item from inside an array
Moderator: General Moderators
remove an item from inside an array
I'm new to PHP and am working on a shopping cart that I'm doing for my final project and we are instructed to do this using arrays. We are use array_push to put the item we are adding at the end of the array which I already have done but the problem I'm running into is removing the cart item from the array. Following the instructions I have to remove an item from an array: how do I change the value of the item I wish to delete within the array to "z" so I can use array_pop to remove it? Any advice would be helpful.
You might also take a look at
array_splice()
ps : php manual is very helpful : http://ca.php.net/manual/en/function.array-splice.php
array_splice()
ps : php manual is very helpful : http://ca.php.net/manual/en/function.array-splice.php
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK