Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9112817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:49:34+00:00 2026-06-17T03:49:34+00:00

Im working on Add to cart module, the session array that i am finally

  • 0

Im working on Add to cart module, the session array that i am finally getting is something like this:

    Array
(
    [cart] => Array
        (
            [0] => Array
                (
                    [item] => Array
                        (
                            [item_name] => burger
                            [item_price] => 5
                            [item_qty] => 3
                        )

                )

            [1] => Array
                (
                    [item] => Array
                        (
                            [item_name] => pizza
                            [item_price] => 15
                            [item_qty] => 2
                        )

                )

            [2] => Array
                (
                    [item] => Array
                        (
                            [item_name] => french fries
                            [item_price] => 8
                            [item_qty] => 5
                        )

                )

        )

)

I want to remove an item from this array, say the item with name “pizza”. How can i do it??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:49:36+00:00Added an answer on June 17, 2026 at 3:49 am
    function rem_from_array(&$session_array, $name)
    {
      foreach($session_array as $key=>$elem)
        if($elem['item']['item_name']==$name)
        {
          unset($session_array[$key]);
    
          return;
        }
    }
    

    then you should just execute the following code:

    rem_from_array($_SESSION['cart'], 'pizza');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a shopping cart that the user can add/remove order
I am working on a C# Excel VSTO add-in that utilizes the user32.dll to
I'm working on a form to add new Customers. In this form the users
A site I am working on has links for add to cart I would
add to cart not working in mozila firefox but it is working in internet
I have form markup like... <form id='cart' action=/cart/add method=post> <div id=product-variants> <div class=selector-wrapper clearfix>
I'm working on an observer that needs to add (a) serial key(s) to each
I am working on a shopping cart assignment for that I have created a
This little line of code here is from a shopping cart: <a href=javascript:; onclick=simpleCart.add(
I have the working demo is in this link . The markup is something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.