1--TEST--
2Test get_html_translation_table() function : basic functionality - table as HTML_SPECIALCHARS
3--FILE--
4<?php
5/* Prototype  : array get_html_translation_table ( [int $table [, int $quote_style [, string charset_hint]]] )
6 * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
7 * Source code: ext/standard/html.c
8*/
9
10/* test get_html_translation_table() when $table argument is specified as HTML_SPECIALCHARS */
11
12echo "*** Testing get_html_translation_table() : basic functionality ***\n";
13
14// $table as HTML_SEPCIALCHARS and different quote style
15echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --\n";
16$table = HTML_SPECIALCHARS;
17$quote_style = ENT_COMPAT;
18var_dump( get_html_translation_table($table, $quote_style, "UTF-8") );
19
20echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --\n";
21$quote_style = ENT_QUOTES;
22var_dump( get_html_translation_table($table, $quote_style, "UTF-8") );
23
24echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --\n";
25$quote_style = ENT_NOQUOTES;
26var_dump( get_html_translation_table($table, $quote_style, "UTF-8") );
27
28echo "Done\n";
29?>
30--EXPECTF--
31*** Testing get_html_translation_table() : basic functionality ***
32-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --
33array(4) {
34  ["&"]=>
35  string(5) "&amp;"
36  ["""]=>
37  string(6) "&quot;"
38  ["<"]=>
39  string(4) "&lt;"
40  [">"]=>
41  string(4) "&gt;"
42}
43-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --
44array(5) {
45  ["&"]=>
46  string(5) "&amp;"
47  ["""]=>
48  string(6) "&quot;"
49  ["'"]=>
50  string(6) "&#039;"
51  ["<"]=>
52  string(4) "&lt;"
53  [">"]=>
54  string(4) "&gt;"
55}
56-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --
57array(3) {
58  ["&"]=>
59  string(5) "&amp;"
60  ["<"]=>
61  string(4) "&lt;"
62  [">"]=>
63  string(4) "&gt;"
64}
65Done
66