Remove HTML tags

Ran into a problem, I don’t know how to remove html tags… The bottom line is that on my site you can send messages and the text of the message is written to the database, and then gets it. And if you use tags like: <div> </div>then they are treated as html tags, not text. It seems that they can be replaced with &lt;and &gt;

The site is written in php.

Answer 1, authority 100%


$html = '<div> =) </div>';
$html = htmlentities( $html );
echo $html; // -> &lt;div&gt; =) &lt;/div&gt;

Leave a reply

Please enter your comment!
Please enter your name here