title: Remove a child with a specific attribute, in SimpleXML for PHP
body: <p>I have several identical elements with different attributes that I'm accessing with SimpleXML:</p>
  
  <pre><code>&lt;data&gt;
      &lt;seg id="A1"/&gt;
      &lt;seg id="A5"/&gt;
      &lt;seg id="A12"/&gt;
      &lt;seg id="A29"/&gt;
      &lt;seg id="A30"/&gt;
  &lt;/data&gt;
  </code></pre>
  
  <p>I need to remove a specific <strong>seg</strong> element, with an id of "A12", how can I do this?  I've tried looping through the <strong>seg</strong> elements and <em>unset</em>ting the specific one, but this doesn't work, the elements remain.</p>
  
  <pre><code>foreach($doc-&gt;seg as $seg)
  {
      if($seg['id'] == 'A12')
      {
          unset($seg);
      }
  }
  </code></pre>