title: How to remove an element from array and reset the key in php
body: <p>I have an array like below.</p>
  <pre><code>Array ( 
  [items] =&gt; Array ( 
    [0] =&gt; Array ( [product_id] =&gt; 16073 [product_name] =&gt; product one ) 
    [1] =&gt; Array ( [product_id] =&gt; 19137 [product_name] =&gt; product two ) 
    [2] =&gt; Array ( [product_id] =&gt; 19143 [product_name] =&gt; product three ) 
  ) 
  </code></pre>
  <p>)</p>
  <p>I want to delete any of the array element, for example remove( 2nd element) this <code>[1] =&gt; Array ( [product_id] =&gt; 19137 [product_name] =&gt; product two ) </code></p>
  <p>After remove this , i want my final array like below.</p>
  <pre><code>Array ( 
  [items] =&gt; Array ( 
    [0] =&gt; Array ( [product_id] =&gt; 16073 [product_name] =&gt; ARMANI EXCHANGE Rectangular Sunglasses, AX2029S [url] =&gt; url_1) 
    [1] =&gt; Array ( [product_id] =&gt; 19143 [product_name] =&gt; OLIVER PEOPLES L.A. Rectangular Sunglasses, OV1289S  [url] =&gt; url_2) 
  ) 
  </code></pre>
  <p>)</p>
  <p>I tried <code>array_values()</code> function, it will not give me the result.
  I am unable to re arrange the array format or anything, i want to achieve this with this format only. Can some one please suggest me a way to do this?</p>
  <p><strong>Update</strong></p>
  <pre><code>$productId = $this-&gt;request-&gt;getParam('product_id');
      $customerSessionData = $this-&gt;customerModelSessionFactory-&gt;create();
      $products = $customerSessionData-&gt;getHtoProducts(); 
      foreach($products['items'] as $key  =&gt; $product){
          if($product['product_id'] == $productId){
              unset($products['items'][$key]);
              $product_name = $product['product_name'];
              
          }
      }
      array_values($products); print_r($products);
      $customerSessionData-&gt;setHtoProducts($products);
  </code></pre>