Close unclosed HTML tags in PHP

Recently I stumped upon a handy WordPress function which closes HTML tags.

The function name is force_balance_tags().

Taking as an example unclosed list items:

echo force_balance_tags( '<ul>
</ul>' );

It will produce something like this:



Leave a Reply to Kuba Mikita Cancel reply

Your email address will not be published.