Annotation of embedaddon/php/ext/standard/tests/strings/strip_tags_variation9.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test strip_tags() function : usage variations - double quoted strings
3: --INI--
4: short_open_tag = on
5: --FILE--
6: <?php
7: /* Prototype : string strip_tags(string $str [, string $allowable_tags])
8: * Description: Strips HTML and PHP tags from a string
9: * Source code: ext/standard/string.c
10: */
11:
12: /*
13: * testing functionality of strip_tags() by giving double quoted strings as values for $str argument
14: */
15:
16: echo "*** Testing strip_tags() : usage variations ***\n";
17:
18: $double_quote_string = array (
19: "<html> \$ -> This represents the dollar sign</html><?php echo hello ?>",
20: "<html>\t\r\v The quick brown fo\fx jumped over the lazy dog</p>",
21: "<a>This is a hyper text tag</a>",
22: "<? <html>hello world\\t</html>?>",
23: "<p>This is a paragraph</p>",
24: "<b>This is \ta text in bold letters\r\s\malong with slashes\n</b>"
25: );
26:
27: $quotes = "<html><a><p><b><?php";
28:
29: //loop through the various elements of strings array to test strip_tags() functionality
30: $iterator = 1;
31: foreach($double_quote_string as $string_value)
32: {
33: echo "-- Iteration $iterator --\n";
34: var_dump( strip_tags($string_value, $quotes) );
35: $iterator++;
36: }
37:
38: echo "Done";
39: --EXPECTF--
40: *** Testing strip_tags() : usage variations ***
41: -- Iteration 1 --
42: string(50) "<html> $ -> This represents the dollar sign</html>"
43: -- Iteration 2 --
44: string(59) "<html>
The quick brown fox jumped over the lazy dog</p>"
45: -- Iteration 3 --
46: string(31) "<a>This is a hyper text tag</a>"
47: -- Iteration 4 --
48: string(0) ""
49: -- Iteration 5 --
50: string(26) "<p>This is a paragraph</p>"
51: -- Iteration 6 --
52: string(62) "<b>This is a text in bold letters
\s\malong with slashes
53: </b>"
54: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>