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