Annotation of embedaddon/php/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test htmlspecialchars_decode() function : usage variations - single quoted strings for 'string' argument
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: /*
11: * Testing htmlspecialchars_decode() with various single quoted strings as argument for $string
12: */
13:
14: echo "*** Testing htmlspecialchars_decode() : usage variations ***\n";
15:
16: //single quoted strings
17: $values = array (
18: 'Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "',
19: 'Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "',
20: '\nRoy's height >\t; Sam's\v height\f',
21: '\r\tRoy's height >\r; Sam\t's height',
22: '\n 1\t3 &\tgt; 11 but 11 &\tlt; 12',
23: );
24:
25: // loop through each element of the values array to check htmlspecialchars_decode() function with all possible arguments
26: $iterator = 1;
27: foreach($values as $value) {
28: echo "-- Iteration $iterator --\n";
29: var_dump( htmlspecialchars_decode($value) );
30: var_dump( htmlspecialchars_decode($value, ENT_COMPAT) );
31: var_dump( htmlspecialchars_decode($value, ENT_NOQUOTES) );
32: var_dump( htmlspecialchars_decode($value, ENT_QUOTES) );
33: $iterator++;
34: }
35:
36: echo "Done";
37: ?>
38: --EXPECTF--
39: *** Testing htmlspecialchars_decode() : usage variations ***
40: -- Iteration 1 --
41: string(90) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string ""
42: string(90) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string ""
43: string(100) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string ""
44: string(85) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string ""
45: -- Iteration 2 --
46: string(88) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string ""
47: string(88) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string ""
48: string(98) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string ""
49: string(78) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string ""
50: -- Iteration 3 --
51: string(48) "\nRoy's height >\t; Sam's\v height\f"
52: string(48) "\nRoy's height >\t; Sam's\v height\f"
53: string(48) "\nRoy's height >\t; Sam's\v height\f"
54: string(38) "\nRoy's height >\t; Sam's\v height\f"
55: -- Iteration 4 --
56: string(48) "\r\tRoy's height >\r; Sam\t's height"
57: string(48) "\r\tRoy's height >\r; Sam\t's height"
58: string(48) "\r\tRoy's height >\r; Sam\t's height"
59: string(38) "\r\tRoy's height >\r; Sam\t's height"
60: -- Iteration 5 --
61: string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
62: string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
63: string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
64: string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
65: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>