get_html_translation_table
Returns the translation table used by htmlspecialchars and htmlentities
&reftitle.description;
arrayget_html_translation_table
inttableHTML_SPECIALCHARS
intflagsENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401
stringencoding"UTF-8"
get_html_translation_table will return the
translation table that is used internally for
htmlspecialchars and
htmlentities.
Special characters can be encoded in several ways. E.g.
" can be encoded as ",
" or ".
get_html_translation_table returns only the form used
by htmlspecialchars and
htmlentities.
&reftitle.parameters;
table
Which table to return. Either HTML_ENTITIES or
HTML_SPECIALCHARS.
flags
A bitmask of one or more of the following flags, which specify which quotes the
table will contain as well as which document type the table is for. The default is
ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401.
Available flags constants
Constant Name
Description
ENT_COMPAT
Table will contain entities for double-quotes, but not for single-quotes.
ENT_QUOTES
Table will contain entities for both double and single quotes.
ENT_NOQUOTES
Table will neither contain entities for single quotes nor for double quotes.
ENT_SUBSTITUTE
Replace invalid code unit sequences with a Unicode Replacement Character
U+FFFD (UTF-8) or � (otherwise) instead of returning an empty string.
ENT_HTML401
Table for HTML 4.01.
ENT_XML1
Table for XML 1.
ENT_XHTML
Table for XHTML.
ENT_HTML5
Table for HTML 5.
encoding
Encoding to use.
If omitted, the default value for this argument is UTF-8.
&reference.strings.charsets;
&reftitle.returnvalues;
Returns the translation table as an array, with the original characters
as keys and entities as values.
&reftitle.changelog;
&Version;
&Description;
8.1.0
flags changed from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401.
&reftitle.examples;
Translation Table Example
]]>
&example.outputs.similar;
string(9) "
"
["!"]=>
string(6) "!"
["""]=>
string(6) """
["#"]=>
string(5) "#"
["$"]=>
string(8) "$"
["%"]=>
string(8) "%"
["&"]=>
string(5) "&"
["'"]=>
string(6) "'"
// ...
}
]]>
&reftitle.seealso;
htmlspecialchars
htmlentities
html_entity_decode