Definition: Htmlspecialchars () is used to convert special characters to HTML entities so their meanings are preserved. It will return the altered string. It is phrased as: htmlspecialchars ( string, quote_style ,charset ). Both quote_stype and charset are optional, and do not need to be included.
Also Known As: HTML Special Characters
<?php $convert = htmlspecialchars("<a href='http://www.mysite.com'>Links</a>"); echo $convert; ?>
'&' (ampersand) becomes '&'
'"' (double quote) becomes '"' when ENT_NOQUOTES is not set.
''' (single quote) becomes ''' only when ENT_QUOTES is set.
'<' (less than) becomes '<'
'>' (greater than) becomes '>'