We have text, decorated in html tags. For example:
<ul> <li>слова</li> <li>слова</li> <li>слова</li> <li>слова</li> <li>слова</li> <li>слова</li> </ul> <p><span id="more-172"></span><br /> <img src="http://картинка" alt="картинка" title="картинка" width="100" height="100" class="aligncenter size-full wp-image-100" /><br /> слова слова слова слова слова слова слова слова слова слова слова слова слова.</p> How to make a selection of the first 20 words? Practices: I think somehow I need to use explode. Sampling by spaces will not work. For example, if there are double spaces or a line break, then an error will already occur (incorrect operation). Clear text is obtained naturally using strip_tags.