title: How do you remove an array element in a foreach loop?
body: <p>I want to loop through an array with <code>foreach</code> to check if a value exists. If the value does exist, I want to delete the element which contains it.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>foreach($display_related_tags as $tag_name) {
      if($tag_name == $found_tag['name']) {
          // Delete element
      }
  }
  </code></pre>
  
  <p>I don't know how to delete the element once the value is found. How do I delete it?</p>
  
  <p>I have to use <code>foreach</code> for this problem. There are probably alternatives to <code>foreach</code>, and you are welcome to share them.</p>