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) "&" 36 ["""]=> 37 string(6) """ 38 ["<"]=> 39 string(4) "<" 40 [">"]=> 41 string(4) ">" 42} 43-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES -- 44array(5) { 45 ["&"]=> 46 string(5) "&" 47 ["""]=> 48 string(6) """ 49 ["'"]=> 50 string(6) "'" 51 ["<"]=> 52 string(4) "<" 53 [">"]=> 54 string(4) ">" 55} 56-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES -- 57array(3) { 58 ["&"]=> 59 string(5) "&" 60 ["<"]=> 61 string(4) "<" 62 [">"]=> 63 string(4) ">" 64} 65Done 66