PHP.nl

get_html_translation_table

get_html_translation_table

Returns the translation table used by htmlspecialchars and htmlentities

array **get_html_translation_table** int $table int $flags string $encoding
will return the

translation table that is used internally for and . get_html_translation_table``htmlspecialchars``htmlentities

Opmerking: > Special characters can be encoded in several ways. E.g. can be encoded as , or . returns only the form used by and . "``"``"``&#x22``get_html_translation_table``htmlspecialchars``htmlentities

table Which table to return. Either or . HTML_ENTITIES``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`

encodingEncoding to use. If omitted, the default value for this argument is UTF-8.

Returns the translation table as an array, with the original characters as keys and entities as values.

Voorbeeld: Translation Table Example

<?php
var_dump(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES | ENT_HTML5));
?>
array(1510) {
  ["
"]=>
  string(9) "NewLine"
  ["!"]=>
  string(6) "excl"
  ["""]=>
  string(6) "&quot;"
  ["#"]=>
  string(5) "num"
  ["$"]=>
  string(8) "dollar"
  ["%"]=>
  string(8) "percnt"
  ["&"]=>
  string(5) "&amp;"
  ["'"]=>
  string(6) "&apos;"
  // ...
}

htmlspecialchars``htmlentities``html_entity_decode