The get_html_translation_table() function returns the translation table used by htmlspecialchars() and htmlentities().
Syntax
get_html_translation_table(func, table, flags)
Parameters
func − The translation table to return.
The following are the possible values −
HTML_SPECIALCHARS - Default. Translates some characters that need URL-encoding to be shown properly on a HTML page
HTML_ENTITIES - Translates all characters that need URL-encoding to be shown properly on a HTML page.
table − It contains the information about which table to return either HTML_ENTITIES or HTML_SPECIALCHARS
flags − The flag information
Return
The get_html_translation_table() function returns the translation table as an array with the original characters as keys and entities as values.
The following is an example −
Example
<?php print_r (get_html_translation_table(HTML_SPECIALCHARS)); ?>
The following is the output −
Output
Array ( ["] => " [&] => & [<] => < [>] => > )
Let us see another example −
Example
<?php print_r (get_html_translation_table(HTML_SPECIALCHARS)); ?>
The following is the output −
Output
Array ( ["] => " [&] => & [<] => < [>] => > )