1--TEST-- 2Test strip_tags() function : usage variations - invalid values for 'str' and 'allowable_tags' 3--FILE-- 4<?php 5/* 6 * testing functionality of strip_tags() by giving invalid values for $str and $allowable_tags argument 7*/ 8 9echo "*** Testing strip_tags() : usage variations ***\n"; 10 11$strings = array ( 12 "<abc>hello</abc> \t\tworld... <ppp>strip_tags_test</ppp>", 13 '<abc>hello</abc> \t\tworld... <ppp>strip_tags_test</ppp>', 14 "<%?php hello\t world?%>", 15 '<%?php hello\t world?%>', 16 "<<htmL>>hello<</htmL>>", 17 '<<htmL>>hello<</htmL>>', 18 "<a.>HtMl text</.a>", 19 '<a.>HtMl text</.a>', 20 "<nnn>I am not a valid html text</nnn>", 21 '<nnn>I am not a valid html text</nnn>', 22 "<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>", 23 '<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>', 24); 25 26$quotes = "<nnn><abc><%?<<html>>"; 27 28//loop through the various elements of strings array to test strip_tags() functionality 29$iterator = 1; 30foreach($strings as $string_value) 31{ 32 echo "-- Iteration $iterator --\n"; 33 var_dump( strip_tags($string_value, $quotes) ); 34 $iterator++; 35} 36 37echo "Done"; 38?> 39--EXPECT-- 40*** Testing strip_tags() : usage variations *** 41-- Iteration 1 -- 42string(43) "<abc>hello</abc> world... strip_tags_test" 43-- Iteration 2 -- 44string(45) "<abc>hello</abc> \t\tworld... strip_tags_test" 45-- Iteration 3 -- 46string(0) "" 47-- Iteration 4 -- 48string(0) "" 49-- Iteration 5 -- 50string(18) "<htmL>hello</htmL>" 51-- Iteration 6 -- 52string(18) "<htmL>hello</htmL>" 53-- Iteration 7 -- 54string(9) "HtMl text" 55-- Iteration 8 -- 56string(9) "HtMl text" 57-- Iteration 9 -- 58string(37) "<nnn>I am not a valid html text</nnn>" 59-- Iteration 10 -- 60string(37) "<nnn>I am not a valid html text</nnn>" 61-- Iteration 11 -- 62string(73) "<nnn>I am a quoted (") string with special chars like $,\!,\@,\%,\&</nnn>" 63-- Iteration 12 -- 64string(75) "<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>" 65Done 66