In my application people are posting comments, and some times the user doesn't close the tags so it destroys all my layout.
I allow user to post html comment.
For example they post this way :
<center><b>Hello
So what I want is to close the tags on it and make it this way:
<center><b>Hello</b></center>
I searched on Google but din't find a good solution so I am here.
I tried this method but it does not work.
$yourText = $row['content'];
$doc = new DOMDocument();
$doc->loadHTML("$yourText");
$yourText = $doc->saveHTML();
Thanks.