FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Removing specific array items
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Removing specific array items [message #177971 is a reply to message #177969] Thu, 03 May 2012 15:20 Go to previous messageGo to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
Am 03.05.2012 15:25, schrieb Scott Johnson:
> 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.

unset($_SESSION['quote'][item_id]);

/Str.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Session variables..
Next Topic: Re: reading a newline from a properties file
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 29 23:40:52 GMT 2024

Total time taken to generate the page: 0.04216 seconds