php, checking correctnes of text splitting -


i need split html document on 2 parts. first part, should contain n(30) words, , next 1 should contain else. , main problem, prevent splitting tags (description , body of tags).

  1. <a **<=>** href="text" > text </a>

  2. <a href="text" > **<=>** text </a>

  3. <a href="text" > text </ **<=>** a>

give me please suggestions (or if have written such function, please share code), how realize it! thanks.

use dom parser, documentation can find @ http://php.net/manual/en/book.dom.php

you can parse html in tree class, , result tree manipulation , saving data.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -