Answer the question
In order to leave comments, you need to log in
How to cut a div block?
$string ='
<div class="one">
<p>sdfg</p>
<p>sdfg</p>
<p>sdfg</p>
<div class="two">
<p>sdfg</p>
<p>sdfg</p>
</div>
</div>';
function parse($p1, $p2, $p3) {
$num1 = strpos($p1, $p2);
$num2 = substr($p1, $num1);
return substr($num2, 0, strpos($num2, $p3));
}
echo parse($string, '<div class="one">', '</div>');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question