I have to get <p> and <br />
tags positions in whole html code. If I use strpos function, I get only first tag position. Does it possible to make this function greedy or something ? Or maybe there is any other solution(function) ?
Your help would be appreciated.
strpos
has a third optional argument that allows you to specify an offset from where you want to start searching. Fill it with the position of the last occurrence + 1.
However, this all looks a bit fishy. If you trying to read or write arbitrary HTML, you ought to use DOMDocument
or another extension/library designed for HTML parsing.