The htmlentities() function converts characters to HTML entities.
string htmlentities ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = ini_get("default_charset") [, bool $double_encode = TRUE ]]] )
Example #1 A htmlentities() example
Example #2 Usage of ENT_IGNORE
Parameter | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
string | Required. Specifies the string to convert | ||||||||||||||||||||||||||||||||||||||||||||||||||||
flags | Optional. Specifies how to handle quotes, invalid encoding and the used document type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
The available quote styles are: | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Invalid encoding:
| ENT_SUBSTITUTE - Replaces invalid encoding for a specified character set with a Unicode Replacement Character U+FFFD (UTF-8) or FFFD; instead of returning an empty string.
| ENT_DISALLOWED - Replaces code points that are invalid in the specified doctype with a Unicode Replacement Character U+FFFD (UTF-8) or FFFD;
| Additional flags for specifying the used doctype:
| character-set | Optional. A string that specifies which character-set to use.
| Allowed values are:
| |
The absolute value of number. If the argument number is of type float, the return type is also float, otherwise it is integer (as float usually has a bigger value range than integer).