English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The get_html_translation_table() function is used to return the conversion table after using htmlspecialchars() and htmlentities().
array get_html_translation_table ([ int $table = HTML_SPECIALCHARS [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = "UTF-8"]]]
It returns the conversion table used by the htmlentities() and htmlspecialchars() functions.
It returns the conversion table as an array, with the original character as the key and the entity as the value.
Note: Special characters can be converted in multiple ways. For example: " can be converted to ", " or ". get_html_translation_table() returns the most commonly used one.
Serial number | Parameters and descriptions |
---|---|
1 | table (required) It contains information about which table HTML_ENTITIES or HTML_SPECIALCHARS should be returned Possible values:
|
2 | flags Optional. Specifies which quotes the conversion table will include and which document type the conversion table is used for.Available quote types:
Additional flags specifying the document type for which the conversion table is applicable:
|
3 | encoding Optional. A string that specifies the character set to be used.Allowed values:
Note:In PHP 5.4 earlier versions, unrecognized character sets will be ignored and replaced by ISO-8859-1 Instead, since PHP 5.4 Starting from PHP-8 instead. |
Try the following example, using the conversion table of HTML_SPECIALCHARS:
<?php //Use the conversion table of HTML_SPECIALCHARS print_r(get_html_translation_table(HTML_SPECIALCHARS)); ?>Test and see‹/›
Output Result
Array ( ["] => " [&] => & [<] => << [>] => >> )