How do I find an occurrence in a string after a specific occurrence in php?

Glenn

Member
I'm looking for
$startpos = strpos($page, '<div id="yada yada"') + 7;

I want to set $endpos to the position of the closing div, "</div>". If I do that, it will read the first closing div and not the one that I want. How do I find the next /div after the start one I found?
 

chrishirst

Well-Known Member
Staff member
Count the number of opening div tags following the one you want then find the n+1 instance of the closing div tags.
 
Top