Annotation of embedaddon/php/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test htmlspecialchars_decode() function : basic functionality 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : string htmlspecialchars_decode(string $string [, int $quote_style])
                      6:  * Description: Convert special HTML entities back to characters 
                      7:  * Source code: ext/standard/html.c
                      8: */
                      9: 
                     10: echo "*** Testing htmlspecialchars_decode() : basic functionality ***\n";
                     11: 
                     12: 
                     13: // Initialise arguments 
                     14: //value initialized = Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. "double quoted string"
                     15: $single_quote_string = "Roy&#039;s height &gt; Sam&#039;s height. 13 &lt; 25. 1111 &amp; 0000 = 0000. &quot; double quoted string &quot;";
                     16: $double_quote_string = "Roy&#039;s height &gt; Sam&#039;s height. 13 &lt; 25. 1111 &amp; 0000 = 0000. &quot; double quoted string &quot;";
                     17: 
                     18: // Calling htmlspecialchars_decode() with default arguments
                     19: var_dump( htmlspecialchars_decode($single_quote_string) );
                     20: var_dump( htmlspecialchars_decode($double_quote_string) );
                     21: 
                     22: // Calling htmlspecialchars_decode() with optional 'quote_style' argument
                     23: var_dump( htmlspecialchars_decode($single_quote_string, ENT_COMPAT) );
                     24: var_dump( htmlspecialchars_decode($double_quote_string, ENT_COMPAT) );   
                     25: var_dump( htmlspecialchars_decode($single_quote_string, ENT_NOQUOTES) );
                     26: var_dump( htmlspecialchars_decode($double_quote_string, ENT_NOQUOTES) );
                     27: var_dump( htmlspecialchars_decode($single_quote_string, ENT_QUOTES) );
                     28: var_dump( htmlspecialchars_decode($double_quote_string, ENT_QUOTES) );
                     29: 
                     30: echo "Done";
                     31: ?>
                     32: --EXPECTF--
                     33: *** Testing htmlspecialchars_decode() : basic functionality ***
                     34: string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
                     35: string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
                     36: string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
                     37: string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
                     38: string(102) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. &quot; double quoted string &quot;"
                     39: string(102) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. &quot; double quoted string &quot;"
                     40: string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
                     41: string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
                     42: Done

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