Annotation of embedaddon/php/ext/standard/tests/strings/get_html_translation_table_basic3.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test 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: 
                     12: echo "*** Testing get_html_translation_table() : basic functionality ***\n";
                     13: 
                     14: // $table as HTML_SEPCIALCHARS and different quote style
                     15: echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --\n";
                     16: $table = HTML_SPECIALCHARS;
                     17: $quote_style = ENT_COMPAT;
1.1.1.2 ! misho      18: $tt = get_html_translation_table($table, $quote_style, "UTF-8");
        !            19: asort( $tt );
        !            20: var_dump( $tt );
1.1       misho      21: 
                     22: echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --\n";
                     23: $quote_style = ENT_QUOTES;
1.1.1.2 ! misho      24: $tt = get_html_translation_table($table, $quote_style, "UTF-8");
        !            25: asort( $tt );
        !            26: var_dump( $tt );
1.1       misho      27: 
                     28: echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --\n";
                     29: $quote_style = ENT_NOQUOTES;
1.1.1.2 ! misho      30: $tt = get_html_translation_table($table, $quote_style, "UTF-8");
        !            31: asort( $tt );
        !            32: var_dump( $tt );
1.1       misho      33: 
                     34: echo "Done\n";
                     35: ?>
                     36: --EXPECTF--
                     37: *** Testing get_html_translation_table() : basic functionality ***
                     38: -- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --
                     39: array(4) {
                     40:   ["&"]=>
                     41:   string(5) "&amp;"
                     42:   [">"]=>
                     43:   string(4) "&gt;"
1.1.1.2 ! misho      44:   ["<"]=>
        !            45:   string(4) "&lt;"
        !            46:   ["""]=>
        !            47:   string(6) "&quot;"
1.1       misho      48: }
                     49: -- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTES --
                     50: array(5) {
                     51:   ["'"]=>
                     52:   string(6) "&#039;"
1.1.1.2 ! misho      53:   ["&"]=>
        !            54:   string(5) "&amp;"
1.1       misho      55:   [">"]=>
                     56:   string(4) "&gt;"
1.1.1.2 ! misho      57:   ["<"]=>
        !            58:   string(4) "&lt;"
        !            59:   ["""]=>
        !            60:   string(6) "&quot;"
1.1       misho      61: }
                     62: -- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTES --
                     63: array(3) {
                     64:   ["&"]=>
                     65:   string(5) "&amp;"
                     66:   [">"]=>
                     67:   string(4) "&gt;"
1.1.1.2 ! misho      68:   ["<"]=>
        !            69:   string(4) "&lt;"
1.1       misho      70: }
                     71: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>