1--TEST-- 2Test strip_tags() function : usage variations - double quoted strings 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 12/* 13 * testing functionality of strip_tags() by giving double quoted strings as values for $str argument 14*/ 15 16echo "*** 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; 31foreach($double_quote_string as $string_value) 32{ 33 echo "-- Iteration $iterator --\n"; 34 var_dump( strip_tags($string_value, $quotes) ); 35 $iterator++; 36} 37 38echo "Done"; 39--EXPECTF-- 40*** Testing strip_tags() : usage variations *** 41-- Iteration 1 -- 42string(50) "<html> $ -> This represents the dollar sign</html>" 43-- Iteration 2 -- 44string(59) "<html> 44 The quick brown fox jumped over the lazy dog</p>" 45-- Iteration 3 -- 46string(31) "<a>This is a hyper text tag</a>" 47-- Iteration 4 -- 48string(0) "" 49-- Iteration 5 -- 50string(26) "<p>This is a paragraph</p>" 51-- Iteration 6 -- 52string(62) "<b>This is a text in bold letters 52\s\malong with slashes 53</b>" 54Done 55