title: Removing an item from object in a loop
body: <p>I have a set of Db results that are stored in an object. I need to loop through the results and check a property (using another DB query) and then use an if statement to remove the item from the object. Here is a simplified version of what I'm attempting:</p>
  
  <pre><code>foreach ($products as $product) {
  
      if(!$product-&gt;active) {
          unset($product);
      }
  
  }
  print_r($products);
  </code></pre>
  
  <p>However when I print_r the items are still in the object. I'm getting confused.</p>