title: Removing items from a session
body: <p>I'm having trouble removing items in a session array in a shopping cart project. The following code should take the selected item and remove it from the session. However the end result is just the same session as before with nothing removed. I've seen similar problems by googling, but haven't found a working solution yet. Here is the stripped down code:</p>
  
  <pre><code>&lt;?php
  session_start();
  $removeditem = $_GET['item']; // this identifies the item to be removed
  unset($_SESSION['stuff'][$removeditem]); // "stuff" is the existing array in the session
  ?&gt;
  </code></pre>
  
  <p>Here are what print_r gives for the following (using "7" as the example of the removed item):</p>
  
  <pre><code>$removeditem: 
  7
  
  $_SESSION['stuff'] (before and after removal)
  Array
  (
      [0] =&gt; 7
      [1] =&gt; 24
      [2] =&gt; 36
  )
  </code></pre>
  
  <p>Am I missing something obvious?</p>