get_html_translation_table
Function • Params changed in PHP 8.1
Returns the translation table used by htmlspecialchars and htmlentities.
get_html_translation_table Function synopsis
get_html_translation_table(
int $table = HTML_SPECIALCHARS,
int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401,
string $encoding = "UTF-8"
): array
Parameters
$table
OptionalTypeintDefault valueHTML_SPECIALCHARS
Which table to return. Either HTML_ENTITIES or
HTML_SPECIALCHARS.
$flags
OptionalTypeintDefault valueENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401
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.
$encoding
OptionalTypestringDefault value"UTF-8"
Encoding to use. If omitted, the default value for this argument is UTF-8.
Return value
Typearray
Returns the translation table as an array, with the original characters as keys and entities as values.
Changes to the get_html_translation_table Function
PHP 8.1
- Parameter default value changed for position #2 (
$flags):ENT_COMPATtoENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401
get_html_translation_table(
int $table = HTML_SPECIALCHARS,
- int $flags = ENT_COMPAT,
+ int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401,
string $encoding = "UTF-8"
): array PHP 8.0
- Return type added:
array - Parameter type added for parameter #1 (
$table):int - Parameter default value added for position #1 (
$table):HTML_SPECIALCHARS - Parameter name of parameter #2 changed:
$quote_styleto$flags - Parameter type added for parameter #2 (
$flags):int - Parameter default value added for position #2 (
$flags):ENT_COMPAT - Parameter type added for parameter #3 (
$encoding):string - Parameter default value added for position #3 (
$encoding):"UTF-8"
get_html_translation_table(
- $table,
+ int $table = HTML_SPECIALCHARS,
- $quote_style,
+ int $flags = ENT_COMPAT,
- $encoding
+ string $encoding = "UTF-8"
- )
+ ): array PHP 7.0
- Optional parameter added - #3:
$encoding
-get_html_translation_table($table, $quote_style)
+get_html_translation_table(
+ $table,
+ $quote_style,
+ $encoding
+ ) get_html_translation_table Function Availability
get_html_translation_table Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |