Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #5808
| From | Scott Johnson <noonehome@chalupasworld.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Removing specific array items |
| Date | 2012-05-03 06:25 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <jnu10f$v35$1@dont-email.me> (permalink) |
In a simple quote cart I track items in a session.
$_SESSION['quote'][##] = {data}
Which increments the ## for each added item.
At the time when the client wants to remove an item from the cart I just
clear the {data} from $_SESSION['quote'][item_id] = '';
The issue i run into is when I want to display the cart, i just cant
step thru the array without seeing if a particular item is '', which
works but would like to find a more 'elegant' way.
With all that said, is there a way to remove the item from the array
rather then clear the items data.
I can only think to
1. 'somehow' move or rotate the item to the end of the array and POP it off
2. or even go as far as step thru the array and create a new one with
only populated data items.
I have looked thru the 50+ different array functions and can't seem to
find the right tool. Maybe a combination I am not seeing.
Thanks
Scotty
Back to comp.lang.php | Previous | Next — Next in thread | Find similar | Unroll thread
Removing specific array items Scott Johnson <noonehome@chalupasworld.com> - 2012-05-03 06:25 -0700
Re: Removing specific array items Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-03 10:55 -0400
Re: Removing specific array items Scott Johnson <noonehome@chalupasworld.com> - 2012-05-03 16:32 -0700
Re: Removing specific array items "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-03 17:20 +0200
Re: Removing specific array items Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-05-03 18:05 +0200
csiph-web