get_html_translation_table()
function returns the translation table used by htmlentities()
and htmlspecialchars()
functions.
Tip: Some characters can be encoded in many ways. get_html_translation_table()
function returns the most common encoding.
Output the translation table used by the htmlspecialchars function:
<?php print_r ( get_html_translation_table ( ) ) ; // HTML_SPECIALCHARS is the default ?>
Try it yourself
HTML_SPECIALCHARS translation table:
<?php print_r ( get_html_translation_table ( HTML_SPECIALCHARS ) ) ; ?>
Show character and entity names:
Array ( ["] => " [&] => & [<] => < [>] => > )
HTML_ENTITIES translation table:
<?php print_r ( get_html_translation_table ( HTML_ENTITIES ) ) ; ?>
Show character and entity names:
Array ( ["] => " [&] => & [<] => < [>] => > [ ] => [?] => ? [?] => ¢ [?] => £ [?] => ¤ [?] => ¥ [?] => | [?] => § [?] => ¨ [?] => ? [?] => a [?] => ? [?] => ? [?] => - [?] => ? [?] => ˉ [?] => ° [?] => ± [?] => 2 [?] => 3 [?] => ′ [?] => μ [?] => ? [?] => · [?] => ? [?] => 1 [?] => o [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => à [?] => á [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => è [?] => é [?] => ê [?] => ? [?] => ì [?] => í [?] => ? [?] => ? [?] => D [?] => ? [?] => ò [?] => ó [?] => ? [?] => ? [?] => ? [?] => × [?] => ? [?] => ù [?] => ú [?] => ? [?] => ü [?] => Y [?] => T [?] => ? [?] => à [?] => á [?] => a [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => è [?] => é [?] => ê [?] => ? [?] => ì [?] => í [?] => ? [?] => ? [?] => e [?] => ? [?] => ò [?] => ó [?] => ? [?] => ? [?] => ? [?] => ÷ [?] => ? [?] => ù [?] => ú [?] => ? [?] => ü [?] => y [?] => t [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [Α] => Α [Β] => Β [Γ] => Γ [Δ] => Δ [Ε] => Ε [Ζ] => Ζ [Η] => Η [Θ] => Θ [Ι] => Ι [Κ] => Κ [Λ] => Λ [Μ] => Μ [Ν] => Ν [Ξ] => Ξ [Ο] => Ο [Π] => Π [Ρ] => Ρ [Σ] => Σ [Τ] => Τ [Υ] => Υ [Φ] => Φ [Χ] => Χ [Ψ] => Ψ [Ω] => Ω [α] => α [β] => β [γ] => γ [δ] => δ [ε] => ε [ζ] => ζ [η] => η [θ] => θ [ι] => ι [κ] => κ [λ] => λ [μ] => μ [ν] => ν [ξ] => ξ [ο] => ο [π] => π [ρ] => ρ [?] => ? [σ] => σ [τ] => τ [υ] => υ [φ] => φ [χ] => χ [ψ] => ψ [ω] => ω [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => – [?] => — [?] => ' [?] => ' [?] => ? [?] => “ [?] => ” [?] => ? [?] => ? [?] => ? [?] => ? [?] => … [?] => ‰ [′] => ′ [″] => ″ [?] => ? [?] => ? [ ̄] =>  ̄ [?] => ? [?] => € [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [←] => ← [↑] => ↑ [→] => → [↓] => ↓ [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [∈] => ∈ [?] => ? [?] => ? [∏] => ∏ [∑] => ∑ [?] => ? [?] => ? [√] => √ [∝] => ∝ [∞] => ∞ [∠] => ∠ [∧] => ∧ [∨] => ∨ [∩] => ∩ [∪] => ∪ [∫] => ∫ [∴] => ∴ [~] => ~ [?] => ? [≈] => ≈ [≠] => ≠ [≡] => ≡ [≤] => ≤ [≥] => ≥ [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [⊕] => ⊕ [?] => ? [⊥] => ⊥ [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? [?] => ? )
get_html_translation_table ( function , flags , character - set )
parameter | describe |
---|---|
function |
Optional. Specifies which translation table to return. Possible values:
|
flags |
Optional. Specifies which quotation marks will be included in the translation table and which document type the translation table will be used for. Available quote types:
Additional flags that specify the type of document that the translation table applies to:
|
character-set |
Optional. String value, specifying the set of characters to be used. Allowed values:
Note: In versions prior to PHP 5.4, unrecognized character sets will be ignored and replaced by ISO-8859-1. Since PHP 5.4, unrecognized character sets will be ignored and replaced by UTF-8. |