PHP get_html_translation_table() Function
Complete PHP String Reference
Definition and Usage
The get_html_translation_table() function returns the translation table used
by the htmlentities() and
htmlspecialchars() functions.
Syntax
|
get_html_translation_table(function,quotestyle)
|
| Parameter |
Description |
| function |
Optional. Specifies which translation table to return.
Default is HTML_SPECIALCHARS. Possible values:
- HTML_ENTITIES - Translates all characters that need URL-encoding to
be shown properly on a HTML page
- HTML_SPECIALCHARS - Translates some characters that need
URL-encoding to be shown properly on a HTML page
|
| quotestyle |
Optional. Defines how to encode single and double quotes.
Default is ENT_COMPAT Possible values:
- ENT_COMPAT - Encodes double quotes, not single quotes
- ENT_QUOTES - Encodes double and single quotes
- ENT_NOQUOTES - Does not encode single or double quotes
|
Tips and Notes
Tip: Some characters can be encoded several ways. The
get_html_translation_table() function returns the most common encoding.
Example
In this example we will show both translation tables.:
<?php
print_r (get_html_translation_table());
echo "<br />";
print_r (get_html_translation_table(HTML_ENTITIES));
?>
|
The output of the code above will be:
Array
(
["] => " [<] => < [>] => > [&] => &
)
Array
(
[ ] => [¡] => ¡ [¢] => ¢ [£] => £
[¤] => ¤ [¥] => ¥ [¦] => ¦ [§] => §
[¨] => ¨ [©] => © [ª] => ª [«] => «
[¬] => ¬ [] => [®] => ® [¯] => ¯
[°] => ° [±] => ± [²] => ² [³] => ³
[´] => ´ [µ] => µ [¶] => ¶ [·] => ·
[¸] => ¸ [¹] => ¹ [º] => º [»] => »
[¼] => ¼ [½] => ½ [¾] => ¾ [¿] => ¿
[À] => À [Á] => Á [Â] => Â [Ã] => Ã
[Ä] => Ä [Å] => Å [Æ] => Æ [Ç] => Ç
[È] => È [É] => É [Ê] => Ê [Ë] => Ë
[Ì] => Ì [Í] => Í [Î] => Î [Ï] => Ï
[Ð] => Ð [Ñ] => Ñ [Ò] => Ò [Ó] => Ó
[Ô] => Ô [Õ] => Õ [Ö] => Ö [×] => ×
[Ø] => Ø [Ù] => Ù [Ú] => Ú [Û] => Û
[Ü] => Ü [Ý] => Ý [Þ] => Þ [ß] => ß
[à] => à [á] => á [â] => â [ã] => ã
[ä] => ä [å] => å [æ] => æ [ç] => ç
[è] => è [é] => é [ê] => ê [ë] => ë
[ì] => ì [í] => í [î] => î [ï] => ï
[ð] => ð [ñ] => ñ [ò] => ò [ó] => ó
[ô] => ô [õ] => õ [ö] => ö [÷] => ÷
[ø] => ø [ù] => ù [ú] => ú [û] => û
[ü] => ü [ý] => ý [þ] => þ [ÿ] => ÿ
["] => " [<] => < [>] => > [&] => &
)
|
Complete PHP String Reference
 |
W3Schools' Online Certification Program
The perfect solution for professionals who need to balance work, family, and career building.
More than 4000 certificates already issued!
|
The HTML Certificate documents your knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
|