$flags= ENT_COMPAT | ENT_HTML401 [, string
$encoding= 'UTF-8' [, bool
$double_encode= true ]]] )
Certain characters have special significance in HTML, and should be represented by HTML entities if they are to preserve their meanings. This function returns a string with these conversions made. If you require all input substrings that have associated named entities to be translated, use htmlentities() instead.
If the input string passed to this function and the final document share the same character set, this function is sufficient to prepare input for inclusion in most contexts of an HTML document. If, however, the input can represent characters that are not coded in the final document character set and you wish to retain those characters (as numeric or named entities), both this function and htmlentities() (which only encodes substrings that have named entity equivalents) may be insufficient. You may have to use mb_encode_numericentity() instead.
The translations performed are:
- '&' (ampersand) becomes '&'
'"' (double quote) becomes '"' when
ENT_NOQUOTESis not set.
"'" (single quote) becomes ''' (or ')
- '<' (less than) becomes '<'
- '>' (greater than) becomes '>'