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; 18$tt = get_html_translation_table($table, $quote_style, "UTF-8"); 19asort( $tt ); 20var_dump( $tt ); 21 22echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --\n"; 23$quote_style = ENT_QUOTES; 24$tt = get_html_translation_table($table, $quote_style, "UTF-8"); 25asort( $tt ); 26var_dump( $tt ); 27 28echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --\n"; 29$quote_style = ENT_NOQUOTES; 30$tt = get_html_translation_table($table, $quote_style, "UTF-8"); 31asort( $tt ); 32var_dump( $tt ); 33 34echo "Done\n"; 35?> 36--EXPECTF-- 37*** Testing get_html_translation_table() : basic functionality *** 38-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT -- 39array(4) { 40 ["&"]=> 41 string(5) "&" 42 [">"]=> 43 string(4) ">" 44 ["<"]=> 45 string(4) "<" 46 ["""]=> 47 string(6) """ 48} 49-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES -- 50array(5) { 51 ["'"]=> 52 string(6) "'" 53 ["&"]=> 54 string(5) "&" 55 [">"]=> 56 string(4) ">" 57 ["<"]=> 58 string(4) "<" 59 ["""]=> 60 string(6) """ 61} 62-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES -- 63array(3) { 64 ["&"]=> 65 string(5) "&" 66 [">"]=> 67 string(4) ">" 68 ["<"]=> 69 string(4) "<" 70} 71Done 72