title: PHP - Unsetting array element in a foreach loop
body: <p>Hi I am trying to remove an array element using a foreach loop, but it does nothing. I need the index to be completely gone rather than making it null. Here is what I have tried:</p>
  
  <pre><code>foreach ($_SESSION['cart']  as &amp;$arrays3) {
      if($arrays3['id'] == $id){
          unset($arrays3);
      }
  }
  </code></pre>
  
  <p>Note, the array value for each key contains an associative array.</p>