I’ve improved the class a lot and I’m still working on making it better. Now, it recovers the single tags (like img and meta and so on) and the rest the same time the other recovered without the single tags.
You have the option of ignoring the single tags. It’s actually much better (the algorithm is improved).
Anyway.. You can download it and view more on the google code page: http://code.google.com/p/php-html2array/
HTML 2 Array – faster and better – v1.02
September 15, 2009 at 12:52 PM


2 Comments:
Thank you for youre script!
I found one small error:
in function existSimpleTags
you fetch all simple tags, but same named interlocked tags returned not correctly
Example HTML-Code
content
Youre preg match returns only:
content
Later when replacement starts the remaining will not replaced.
My regular expression knowledge is not good enought to fix it.
Hope you can do it
HTML-Tags removed hier without clasps.
Example HTML-Code
div id=”level1″ div id=”level2″ content /div /div
Youre preg match returns only:
div id=”level1″ div id=”level2″ content /div