Let’s say, that I have the following source output:
<p>This is first paragraph</p>
<p>This is second paragraph</p>
<p>This is third paragraph</p>
What I want to achieve is… I want to split them, first paragraph goes into one variable, others into other. Like:
$first = "<p>This is first paragraph</p>";
$next = "<p>This is second paragraph</p><p>This is third paragraph</p>";
Because those are generated by TinyMCE and user input, I can never know when user will add <br /> or other tags, which will cause TinyMCE to generate a new code-break \r\n. Therefore, all the solutions which split them by looking for \r\n won’t work this time.
Any advice?
Try this: