I have some fairly large paragraphs (5000-6000 words) containing text and embedded html tags. I want to break this large paragraph in chunks of 1500 words (ignoring the html markup in it) i.e 1500 should include only actual words and not any markup words. Using function strip_tags
i can count the number of words (ignoring the html markup), but i'm not able to figure out how to break it in chunks of 1500 words (still including html markup). For example
This is <b> a </b> paragraph which <a href="#"> has some </a> some text to be broken in <h1> 5 words </h1>.
The result should be
1 = This is <b> a </b> paragraph which
2 = <a href="#"> has some </a> some text to
3 = be broken in <h1> 5 words </h1>.