PHP: How do i remove an element from a multidemision array?
<p>I have this code to add new elements to a multidimension array:</p>

<pre><code>$this-&gt;shopcart[] = array(productID =&gt; $productID, items =&gt; $items);
</code></pre>

<p>So how do i remove an element from this array? I tried this code, but its not working:</p>

<pre><code>public function RemoveItem($item)
{
 foreach($this-&gt;shopcart as $key)
 {
  if($key['productID'] == $item)
  {
   unset($this-&gt;shopcart[$key]);    
  }
 }
}
</code></pre>

<p>I get this error:</p>

<ul>
<li><b>Warning</b>:  Illegal offset type in unset in <b>C:\xampplite\htdocs\katrinelund\classes\TillRepository.php</b> on line <b>50</b><br /></li>
</ul>
