diff --git a/reference/strings/functions/get-html-translation-table.xml b/reference/strings/functions/get-html-translation-table.xml
index 41b744c745..a57414c12d 100644
--- a/reference/strings/functions/get-html-translation-table.xml
+++ b/reference/strings/functions/get-html-translation-table.xml
@@ -11,14 +11,14 @@
arrayget_html_translation_table
inttableHTML_SPECIALCHARS
- intquote_styleENT_COMPAT
- stringcharset_hint
+ intflagsENT_COMPAT | ENT_HTML401
+ stringcharset
get_html_translation_table will return the
translation table that is used internally for
htmlspecialchars and
- htmlentities with the default charset.
+ htmlentities.
@@ -40,32 +40,69 @@
table
- There are two new constants (HTML_ENTITIES,
- HTML_SPECIALCHARS) that allow you to specify the
- table you want.
+ Which table to return. Either HTML_ENTITIES or
+ HTML_SPECIALCHARS.
- quote_style
+ flags
- Like the htmlspecialchars and
- htmlentities functions you can optionally specify
- the quote_style you are working with.
- See the description
- of these modes in htmlspecialchars.
+ 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_COMPAT | ENT_HTML401.
+
+ Available flags constants
+
+
+
+ Constant Name
+ Description
+
+
+
+
+ ENT_COMPAT
+ Table will contain entities for double-quotes, but not for single-quotes.
+
+
+ ENT_QUOTES
+ Table will contain entities for both double and single quotes.
+
+
+ ENT_NOQUOTES
+ Table will neither contain entities for single quotes nor for double quotes.
+
+
+ ENT_HTML401
+ Table for HTML 4.01.
+
+
+ ENT_XML1
+ Table for XML 1.
+
+
+ ENT_XHTML
+ Table for XHTML.
+
+
+ ENT_HTML5
+ Table for HTML 5.
+
+
+
+
- charset_hint
+ charset
- Like htmlentities, it takes an optional
- third argument charset which defines character
- set used in conversion.
- Presently, the ISO-8859-1 character set is used as the default.
+ Character set to use.
+ If omitted, the default value for this argument is ISO-8859-1 in
+ versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards.
&reference.strings.charsets;
@@ -77,7 +114,8 @@
&reftitle.returnvalues;
- Returns the translation table as an array.
+ Returns the translation table as an array, with the original characters
+ as keys and entities as values.
@@ -93,10 +131,24 @@
+
+ 5.4.0
+
+ The default value for the charset parameter was
+ changed to UTF-8.
+
+
+
+ 5.4.0
+
+ The constants ENT_HTML401, ENT_XML1,
+ ENT_XHTML and ENT_HTML5 were added.
+
+
5.3.4
- The charset_hint parameter was added.
+ The charset parameter was added.
@@ -113,18 +165,35 @@
& Krämer";
-$encoded = strtr($str, $trans);
-
-echo $encoded;
+var_dump(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES | ENT_HTML5));
?>
]]>
- &example.outputs;
+ &example.outputs.similar;
+ string(5) "	"
+ ["
+"]=>
+ string(9) "
"
+ ["!"]=>
+ string(6) "!"
+ ["""]=>
+ string(6) """
+ ["#"]=>
+ string(5) "#"
+ ["$"]=>
+ string(8) "$"
+ ["%"]=>
+ string(8) "%"
+ ["&"]=>
+ string(5) "&"
+ ["'"]=>
+ string(6) "'"
+ // ...
+}
]]>