title: removeChild with PHP DOM doesn't work
body: <p>I have the following code:</p>
  
  <pre><code>$doc = new DOMDocument();
  $doc-&gt;loadHTML($quiz['value']);
  $imageElement = $doc-&gt;getElementsByTagName('img')-&gt;item(0);
  }
  if(is_object($imageElement)){ 
      $image = $imageElement-&gt;getAttribute('src');
      $imageElement-&gt;parentNode-&gt;removeChild($imageElement); 
  }else{ 
      $image = '#'; 
  }
  $quiz['value'] = $doc-&gt;saveHTML();
  </code></pre>
  
  <p>However, I get the following error: Fatal error: Call to a member function removeChild() on a non-object.</p>
  
  <p>The loaded dom string may or may not contain an img element.
  Does anybody know what I'm doing wrong here? Any help is greatly appreciated!</p>