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