1--TEST--
2Test get_html_translation_table() function : basic functionality - XML 1.0
3--FILE--
4<?php
5echo "*** Testing get_html_translation_table() : basic functionality/XML 1.0 ***\n";
6
7echo "-- with table = HTML_ENTITIES, ENT_QUOTES --\n";
8$table = HTML_ENTITIES;
9$tt = get_html_translation_table($table, ENT_QUOTES | ENT_XML1, "UTF-8");
10asort( $tt );
11var_dump( count($tt) );
12print_r( $tt );
13
14echo "-- with table = HTML_ENTITIES, ENT_COMPAT --\n";
15$table = HTML_ENTITIES;
16$tt = get_html_translation_table($table, ENT_COMPAT | ENT_XML1, "UTF-8");
17var_dump( count($tt) );
18
19echo "-- with table = HTML_ENTITIES, ENT_NOQUOTES --\n";
20$table = HTML_ENTITIES;
21$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_XML1, "UTF-8");
22var_dump( count($tt) );
23
24echo "-- with table = HTML_SPECIALCHARS, ENT_COMPAT --\n";
25$table = HTML_SPECIALCHARS;
26$tt = get_html_translation_table($table, ENT_COMPAT, "UTF-8");
27asort( $tt );
28var_dump( count($tt) );
29print_r( $tt );
30
31echo "-- with table = HTML_SPECIALCHARS, ENT_QUOTES --\n";
32$table = HTML_SPECIALCHARS;
33$tt = get_html_translation_table($table, ENT_QUOTES | ENT_XML1, "UTF-8");
34asort( $tt );
35var_dump( $tt );
36
37echo "-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --\n";
38$table = HTML_SPECIALCHARS;
39$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_XML1, "UTF-8");
40asort( $tt );
41var_dump( $tt );
42
43
44echo "Done\n";
45?>
46--EXPECT--
47*** Testing get_html_translation_table() : basic functionality/XML 1.0 ***
48-- with table = HTML_ENTITIES, ENT_QUOTES --
49int(5)
50Array
51(
52    [&] => &amp;
53    ['] => &apos;
54    [>] => &gt;
55    [<] => &lt;
56    ["] => &quot;
57)
58-- with table = HTML_ENTITIES, ENT_COMPAT --
59int(4)
60-- with table = HTML_ENTITIES, ENT_NOQUOTES --
61int(3)
62-- with table = HTML_SPECIALCHARS, ENT_COMPAT --
63int(4)
64Array
65(
66    [&] => &amp;
67    [>] => &gt;
68    [<] => &lt;
69    ["] => &quot;
70)
71-- with table = HTML_SPECIALCHARS, ENT_QUOTES --
72array(5) {
73  ["&"]=>
74  string(5) "&amp;"
75  ["'"]=>
76  string(6) "&apos;"
77  [">"]=>
78  string(4) "&gt;"
79  ["<"]=>
80  string(4) "&lt;"
81  ["""]=>
82  string(6) "&quot;"
83}
84-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --
85array(3) {
86  ["&"]=>
87  string(5) "&amp;"
88  [">"]=>
89  string(4) "&gt;"
90  ["<"]=>
91  string(4) "&lt;"
92}
93Done
94