Re: Removing specific array items



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.
.



Relevant Pages

  • Removing specific array items
    ... In a simple quote cart I track items in a session. ... At the time when the client wants to remove an item from the cart I just ... 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. ... or even go as far as step thru the array and create a new one with only populated data items. ...
    (comp.lang.php)
  • Re: Removing specific array items
    ... At the time when the client wants to remove an item from the cart I just ... is there a way to remove the item from the array ... only populated data items. ...
    (comp.lang.php)
  • Re: Removing specific array items
    ... At the time when the client wants to remove an item from the cart I just ... is there a way to remove the item from the array ... only populated data items. ...
    (comp.lang.php)
  • Re: Text terminal rendering design
    ... it is a fundamental element of the UI design. ... The management of that array's content by the client is quite a ... The array and the terminal are more tightly tied ... to do that because of the need to map into flavors of terminals. ...
    (comp.object)
  • Re: passing a NULL pointer from vb6 to an ATL method
    ... Is all this necessary if the client and server are in the same ... local/call_as is necessary fior marshaling. ... Dim array as Double ...
    (microsoft.public.vc.atl)