If you need to display some HTML code on the browser, first you need to convert it into HTML entities. Otherwise, the code will be processed by the PHP. For example, instead of <bold> output, the text itself will become bold.
The htmlspecialchars() Function converts the predefined characters "<" (less than) and ">" (greater than) to HTML entities. The htmlspecialchars() function converts some predefined characters to HTML entities. The predefined characters are:
$str = "This is <b>bold</b> text.";
The browser will display:
This is <b>bold</b> text.