1--TEST--
2Test get_html_translation_table() function : basic functionality - HTML 5/Windows-1251
3--FILE--
4<?php
5
6function so($a,$b) { return ord($a) - ord($b); }
7
8echo "*** Testing get_html_translation_table() : basic functionality - HTML 5/Windows-1251 ***\n";
9
10echo "-- with table = HTML_ENTITIES, ENT_COMPAT --\n";
11$table = HTML_ENTITIES;
12$tt = get_html_translation_table($table, ENT_COMPAT | ENT_HTML5, "Windows-1251");
13uksort( $tt, 'so' );
14var_dump( count($tt) );
15print_r( $tt );
16
17echo "-- with table = HTML_ENTITIES, ENT_QUOTES --\n";
18$table = HTML_ENTITIES;
19$tt = get_html_translation_table($table, ENT_QUOTES | ENT_HTML5, "Windows-1251");
20var_dump( count($tt) );
21
22echo "-- with table = HTML_ENTITIES, ENT_NOQUOTES --\n";
23$table = HTML_ENTITIES;
24$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_HTML5, "Windows-1251");
25var_dump( count($tt) );
26
27echo "-- with table = HTML_SPECIALCHARS, ENT_COMPAT --\n";
28$table = HTML_SPECIALCHARS;
29$tt = get_html_translation_table($table, ENT_COMPAT, "Windows-1251");
30uksort( $tt, 'so' );
31var_dump( count($tt) );
32print_r( $tt );
33
34echo "-- with table = HTML_SPECIALCHARS, ENT_QUOTES --\n";
35$table = HTML_SPECIALCHARS;
36$tt = get_html_translation_table($table, ENT_QUOTES | ENT_HTML5, "Windows-1251");
37uksort( $tt, 'so' );
38var_dump( $tt );
39
40echo "-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --\n";
41$table = HTML_SPECIALCHARS;
42$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_HTML5, "Windows-1251");
43uasort( $tt, 'so' );
44var_dump( $tt );
45
46
47echo "Done\n";
48?>
49--EXPECT--
50*** Testing get_html_translation_table() : basic functionality - HTML 5/Windows-1251 ***
51-- with table = HTML_ENTITIES, ENT_COMPAT --
52int(157)
53Array
54(
55    [	] => &Tab;
56    [
57] => &NewLine;
58    [!] => &excl;
59    ["] => &quot;
60    [#] => &num;
61    [$] => &dollar;
62    [%] => &percnt;
63    [&] => &amp;
64    [(] => &lpar;
65    [)] => &rpar;
66    [*] => &ast;
67    [+] => &plus;
68    [,] => &comma;
69    [.] => &period;
70    [/] => &sol;
71    [:] => &colon;
72    [;] => &semi;
73    [<] => &lt;
74    [=] => &equals;
75    [>] => &gt;
76    [?] => &quest;
77    [@] => &commat;
78    [[] => &lbrack;
79    [\] => &bsol;
80    []] => &rsqb;
81    [^] => &Hat;
82    [_] => &lowbar;
83    [`] => &grave;
84    [fj] => &fjlig
85    [{] => &lbrace;
86    [|] => &vert;
87    [}] => &rcub;
88    [�] => &DJcy;
89    [�] => &GJcy;
90    [�] => &sbquo;
91    [�] => &gjcy;
92    [�] => &bdquo;
93    [�] => &hellip;
94    [�] => &dagger;
95    [�] => &Dagger;
96    [�] => &euro;
97    [�] => &permil;
98    [�] => &LJcy;
99    [�] => &lsaquo;
100    [�] => &NJcy;
101    [�] => &KJcy;
102    [�] => &TSHcy;
103    [�] => &DZcy;
104    [�] => &djcy;
105    [�] => &OpenCurlyQuote;
106    [�] => &rsquo;
107    [�] => &OpenCurlyDoubleQuote;
108    [�] => &rdquo;
109    [�] => &bull;
110    [�] => &ndash;
111    [�] => &mdash;
112    [�] => &trade;
113    [�] => &ljcy;
114    [�] => &rsaquo;
115    [�] => &njcy;
116    [�] => &kjcy;
117    [�] => &tshcy;
118    [�] => &dzcy;
119    [�] => &nbsp;
120    [�] => &Ubrcy;
121    [�] => &ubrcy;
122    [�] => &Jsercy;
123    [�] => &curren;
124    [�] => &brvbar;
125    [�] => &sect;
126    [�] => &IOcy;
127    [�] => &copy;
128    [�] => &Jukcy;
129    [�] => &laquo;
130    [�] => &not;
131    [�] => &shy;
132    [�] => &reg;
133    [�] => &YIcy;
134    [�] => &deg;
135    [�] => &plusmn;
136    [�] => &Iukcy;
137    [�] => &iukcy;
138    [�] => &micro;
139    [�] => &para;
140    [�] => &CenterDot;
141    [�] => &iocy;
142    [�] => &numero;
143    [�] => &jukcy;
144    [�] => &raquo;
145    [�] => &jsercy;
146    [�] => &DScy;
147    [�] => &dscy;
148    [�] => &yicy;
149    [�] => &Acy;
150    [�] => &Bcy;
151    [�] => &Vcy;
152    [�] => &Gcy;
153    [�] => &Dcy;
154    [�] => &IEcy;
155    [�] => &ZHcy;
156    [�] => &Zcy;
157    [�] => &Icy;
158    [�] => &Jcy;
159    [�] => &Kcy;
160    [�] => &Lcy;
161    [�] => &Mcy;
162    [�] => &Ncy;
163    [�] => &Ocy;
164    [�] => &Pcy;
165    [�] => &Rcy;
166    [�] => &Scy;
167    [�] => &Tcy;
168    [�] => &Ucy;
169    [�] => &Fcy;
170    [�] => &KHcy;
171    [�] => &TScy;
172    [�] => &CHcy;
173    [�] => &SHcy;
174    [�] => &SHCHcy;
175    [�] => &HARDcy;
176    [�] => &Ycy;
177    [�] => &SOFTcy;
178    [�] => &Ecy;
179    [�] => &YUcy;
180    [�] => &YAcy;
181    [�] => &acy;
182    [�] => &bcy;
183    [�] => &vcy;
184    [�] => &gcy;
185    [�] => &dcy;
186    [�] => &iecy;
187    [�] => &zhcy;
188    [�] => &zcy;
189    [�] => &icy;
190    [�] => &jcy;
191    [�] => &kcy;
192    [�] => &lcy;
193    [�] => &mcy;
194    [�] => &ncy;
195    [�] => &ocy;
196    [�] => &pcy;
197    [�] => &rcy;
198    [�] => &scy;
199    [�] => &tcy;
200    [�] => &ucy;
201    [�] => &fcy;
202    [�] => &khcy;
203    [�] => &tscy;
204    [�] => &chcy;
205    [�] => &shcy;
206    [�] => &shchcy;
207    [�] => &hardcy;
208    [�] => &ycy;
209    [�] => &softcy;
210    [�] => &ecy;
211    [�] => &yucy;
212    [�] => &yacy;
213)
214-- with table = HTML_ENTITIES, ENT_QUOTES --
215int(158)
216-- with table = HTML_ENTITIES, ENT_NOQUOTES --
217int(156)
218-- with table = HTML_SPECIALCHARS, ENT_COMPAT --
219int(4)
220Array
221(
222    ["] => &quot;
223    [&] => &amp;
224    [<] => &lt;
225    [>] => &gt;
226)
227-- with table = HTML_SPECIALCHARS, ENT_QUOTES --
228array(5) {
229  ["""]=>
230  string(6) "&quot;"
231  ["&"]=>
232  string(5) "&amp;"
233  ["'"]=>
234  string(6) "&apos;"
235  ["<"]=>
236  string(4) "&lt;"
237  [">"]=>
238  string(4) "&gt;"
239}
240-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --
241array(3) {
242  [">"]=>
243  string(4) "&gt;"
244  ["<"]=>
245  string(4) "&lt;"
246  ["&"]=>
247  string(5) "&amp;"
248}
249Done
250