title: Parse HTML with htmlDOM, replace all iframe tags with another
body: <p>I am using the html DOMDocument to find all instances of iFrames w/in a <code>$content</code> variable.  I am able to output an image for each instance but would rather replace the iframe with the image and then save back to the content variable.  Instead of <code>echo</code>ing my result I would like to replace the current iframe.  How do I do this?</p>
  
  <pre><code>        $count = 1;
          $dom = new DOMDocument;
          $dom-&gt;loadHTML($content);
          $iframes = $dom-&gt;getElementsByTagName('iframe');
          foreach ($iframes as $iframe) {
              echo "&lt;img class='iframe-".self::return_video_type($iframe-&gt;getAttribute('src'))." iframe-ondemand-placeholderImg iframe-".$count."' src='" .$placeholder_image. "' height='".$iframe-&gt;getAttribute('height')."' width='" .$iframe-&gt;getAttribute('width'). "' data-iframe-src='" .$iframe-&gt;getAttribute('src'). "' /&gt;&lt;br /&gt;";
              $count++;
          }
          $content = $dom-&gt;saveHTML();
  
          return $content;
  </code></pre>