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