title: Do not add an item to a session array if it already exists
body: <p>Hi I am a bit of a newbie here - so please bear with me.
  I am trying to create a WishList - similar to a shopping cart but without the payment gateway. Anyway.</p>
  
  <p>I have the following code which adds an item to an array when the Add to Wishlist button is clicked</p>
  
  <pre><code>if (isset($_GET['add'])) {
    $ITEM = array(    
      'name' =&gt; $_GET['add']      
    );
  
    $_SESSION['WISH_LIST'][] =  $ITEM;
    header('Location: ' . $_SERVER['PHP_SELF']);
  }
  </code></pre>
  
  <p>I want to make it work so that the item is not added if it is already there.</p>
  
  <p>I tried this</p>
  
  <pre><code>if (isset($_GET['add'])){
    $ITEM = array(    
      'name' =&gt; $_GET['add']      
    );
  
    if ( in_array($_GET['add'], $ITEM) ) {
      echo "Already Added";
    } else {
      $_SESSION['WISH_LIST'][] =  $ITEM;
      header('Location: ' . $_SERVER['PHP_SELF']);
    } 
  }
  </code></pre>
  
  <p>But this never adds the item - I always get the 'Already Added' text.</p>