Remove unmatched HTML tags in a string

Posted by Freeman on Stack Overflow See other posts from Stack Overflow or by Freeman
Published on 2010-04-05T18:25:28Z Indexed on 2010/04/05 18:33 UTC
Read the original article Hit count: 300

Filed under:
|

Folks does anyone knows of a PHP function to remove unmatched HTML tags from a string. for example<div> This is a string <b> with an unmatched bold tag </div>. If there isnt one then help me buld one, maybe I can have a function that counts the number of opening tags and matching closing tags. If they are not even then remove the first opening tag or if closing tags are more, it removes the last tag?

© Stack Overflow or respective owner

Related posts about php

Related posts about regex