1--TEST--
2Test strip_tags() function : basic functionality - with default arguments
3--FILE--
4<?php
5/* Prototype  : string strip_tags(string $str [, string $allowable_tags])
6 * Description: Strips HTML and PHP tags from a string
7 * Source code: ext/standard/string.c
8*/
9
10echo "*** Testing strip_tags() : basic functionality ***\n";
11
12// array of arguments
13$string_array = array (
14  "<html>hello</html>",
15  '<html>hello</html>',
16  "<?php echo hello ?>",
17  '<?php echo hello ?>',
18  "<? echo hello ?>",
19  '<? echo hello ?>',
20  "<% echo hello %>",
21  '<% echo hello %>',
22  "<script language=\"PHP\"> echo hello </script>",
23  '<script language=\"PHP\"> echo hello </script>',
24  "<html><b>hello</b><p>world</p></html>",
25  '<html><b>hello</b><p>world</p></html>',
26  "<html><!-- COMMENT --></html>",
27  '<html><!-- COMMENT --></html>'
28);
29
30
31// Calling strip_tags() with default arguments
32// loop through the $string_array to test strip_tags on various inputs
33$iteration = 1;
34foreach($string_array as $string)
35{
36  echo "-- Iteration $iteration --\n";
37  var_dump( strip_tags($string) );
38  $iteration++;
39}
40
41echo "Done";
42?>
43--EXPECT--
44*** Testing strip_tags() : basic functionality ***
45-- Iteration 1 --
46string(5) "hello"
47-- Iteration 2 --
48string(5) "hello"
49-- Iteration 3 --
50string(0) ""
51-- Iteration 4 --
52string(0) ""
53-- Iteration 5 --
54string(0) ""
55-- Iteration 6 --
56string(0) ""
57-- Iteration 7 --
58string(0) ""
59-- Iteration 8 --
60string(0) ""
61-- Iteration 9 --
62string(12) " echo hello "
63-- Iteration 10 --
64string(12) " echo hello "
65-- Iteration 11 --
66string(10) "helloworld"
67-- Iteration 12 --
68string(10) "helloworld"
69-- Iteration 13 --
70string(0) ""
71-- Iteration 14 --
72string(0) ""
73Done
74