title: PHP How remove element from html dom?
body: <p>We have <strong>index.php</strong> with code:</p>
  
  <pre><code>&lt;div class="test"&gt; text text text text&lt;/div&gt;
  &lt;div class="test2"&gt; text text text text&lt;/div&gt;
  &lt;div class="test3"&gt; text text text text&lt;/div&gt;
  &lt;div class="test4"&gt; text text text text&lt;/div&gt;
  </code></pre>
  
  <p>In file <strong>test.php</strong> we use code:</p>
  
  <pre><code>ob_start(); // start output buffer
  include 'index.php';
  $template = ob_get_contents(); // get contents of buffer
  ob_end_clean();
  return $template;
  </code></pre>
  
  <p>Tell me please how remove div with class <code>test2</code> and all content in him from html which we get in <code>$template</code>?</p>
  
  <p>P.S.: we want remove div with class <code>test2</code> regardless of the attributes inside the div tag.</p>