title: Deleting an item in a foreach loop in PHP
body: <p>I have a foreach loop where I want to unset an item from an array if certain conditions are met, like this:</p>
  
  <pre><code>foreach ($array as $element) {
      if (conditions) {
          unset($element);
      }
  }
  </code></pre>
  
  <p>But the element is not unset after that. What am I doing wrong? Am I unsetting a reference to the actual element or something like that?</p>