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 [ ] => 	 56 [ 57] => 
 58 [!] => ! 59 ["] => " 60 [#] => # 61 [$] => $ 62 [%] => % 63 [&] => & 64 [(] => ( 65 [)] => ) 66 [*] => * 67 [+] => + 68 [,] => , 69 [.] => . 70 [/] => / 71 [:] => : 72 [;] => ; 73 [<] => < 74 [=] => = 75 [>] => > 76 [?] => ? 77 [@] => @ 78 [[] => [ 79 [\] => \ 80 []] => ] 81 [^] => ^ 82 [_] => _ 83 [`] => ` 84 [fj] => fj 85 [{] => { 86 [|] => | 87 [}] => } 88 [�] => Ђ 89 [�] => Ѓ 90 [�] => ‚ 91 [�] => ѓ 92 [�] => „ 93 [�] => … 94 [�] => † 95 [�] => ‡ 96 [�] => € 97 [�] => ‰ 98 [�] => Љ 99 [�] => ‹ 100 [�] => Њ 101 [�] => Ќ 102 [�] => Ћ 103 [�] => Џ 104 [�] => ђ 105 [�] => ‘ 106 [�] => ’ 107 [�] => “ 108 [�] => ” 109 [�] => • 110 [�] => – 111 [�] => — 112 [�] => ™ 113 [�] => љ 114 [�] => › 115 [�] => њ 116 [�] => ќ 117 [�] => ћ 118 [�] => џ 119 [�] => 120 [�] => Ў 121 [�] => ў 122 [�] => Ј 123 [�] => ¤ 124 [�] => ¦ 125 [�] => § 126 [�] => Ё 127 [�] => © 128 [�] => Є 129 [�] => « 130 [�] => ¬ 131 [�] => ­ 132 [�] => ® 133 [�] => Ї 134 [�] => ° 135 [�] => ± 136 [�] => І 137 [�] => і 138 [�] => µ 139 [�] => ¶ 140 [�] => · 141 [�] => ё 142 [�] => № 143 [�] => є 144 [�] => » 145 [�] => ј 146 [�] => Ѕ 147 [�] => ѕ 148 [�] => ї 149 [�] => А 150 [�] => Б 151 [�] => В 152 [�] => Г 153 [�] => Д 154 [�] => Е 155 [�] => Ж 156 [�] => З 157 [�] => И 158 [�] => Й 159 [�] => К 160 [�] => Л 161 [�] => М 162 [�] => Н 163 [�] => О 164 [�] => П 165 [�] => Р 166 [�] => С 167 [�] => Т 168 [�] => У 169 [�] => Ф 170 [�] => Х 171 [�] => Ц 172 [�] => Ч 173 [�] => Ш 174 [�] => Щ 175 [�] => Ъ 176 [�] => Ы 177 [�] => Ь 178 [�] => Э 179 [�] => Ю 180 [�] => Я 181 [�] => а 182 [�] => б 183 [�] => в 184 [�] => г 185 [�] => д 186 [�] => е 187 [�] => ж 188 [�] => з 189 [�] => и 190 [�] => й 191 [�] => к 192 [�] => л 193 [�] => м 194 [�] => н 195 [�] => о 196 [�] => п 197 [�] => р 198 [�] => с 199 [�] => т 200 [�] => у 201 [�] => ф 202 [�] => х 203 [�] => ц 204 [�] => ч 205 [�] => ш 206 [�] => щ 207 [�] => ъ 208 [�] => ы 209 [�] => ь 210 [�] => э 211 [�] => ю 212 [�] => я 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 ["] => " 223 [&] => & 224 [<] => < 225 [>] => > 226) 227-- with table = HTML_SPECIALCHARS, ENT_QUOTES -- 228array(5) { 229 ["""]=> 230 string(6) """ 231 ["&"]=> 232 string(5) "&" 233 ["'"]=> 234 string(6) "'" 235 ["<"]=> 236 string(4) "<" 237 [">"]=> 238 string(4) ">" 239} 240-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES -- 241array(3) { 242 ["&"]=> 243 string(5) "&" 244 ["<"]=> 245 string(4) "<" 246 [">"]=> 247 string(4) ">" 248} 249Done 250