I've finally come back to doing a script I was working on awhile back, where originally I was trying to use a regular expression to find the first two paragraph elements in a block of text, and trim everything that occurred after. With all the learning I've been doing since, I've come to the realization that I can do it much faster with a combination of strpos() and substr(), and I'm just wondering if this is the best syntax here, or if there's something I'm missing that could clean it up even further?
What I'm doing is trying to find the second occurence of </p> and strip everything after. So what I did was this:
strpos() looks for the first occurrence after the specified offset which is why I use it inside of itself to find the first, then use that as the offset to find the second. It clocks in at 0.000061 seconds. The regular expression I was using,