title: Code is executing both if and else when if is true
body: <p>This code is executing both if and else, any help will be appreciated, thank you in advance.</p>
  
  <pre><code>  foreach($each_item as $key =&gt; $product)
    {
      foreach($new_item as $key2 =&gt; $newproduct)
      {
        if (in_array($product['product_id'], $newproduct)) {
          $this-&gt;update_order_items($order_id, $product['product_id'], array(
              "quantity" =&gt; $newproduct['quantity'], 
              "price" =&gt; $newproduct['price']       
              ));
        }
        else
        {
          $this-&gt;delete_order_items($order_id, $product['product_id']);
        }
      }
    }
  </code></pre>