PHP Get text between multiple

tags 请求翻译

I have a page with multiple H1 headings followed by text and so on. Example:

Title 1

Some text here

Title 2

Some more text here

Title 3

Even more text here


What I want to do is create an array of elements, that is explode the HTML using as separator


above that I have in an $output variable.

The final purpose is to count the strlen of the text between the ending and next starting

and if it's higher than 200 characters to hide it inside a with display:none so users can press "Show all" to unhide that.

How can I get that please?