Using PHP, how can I remove HTML text that is placed before/after a certain number of <br>
tags?
For example, I have this,
<div>
<div><img sec=""></div>
<br>
<h3>title</h3>
<span>some text here</span>
<br>
Some text that I want to remove.
<br>
<br>
</div>
I'd like to remove the string before the last two <br>
tags. Or It could be said after the second <br>
.
I tried explode()
with <br>
and omitted the last two array elements with array_push()
. However, I had to add </div>
to close the outer tag. When the outer tag dynamically changes, it's not a good idea.
Does anybody have a solution for this?