1--TEST--
2Test strip_tags() function : usage variations - single quoted strings
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
10/*
11 * testing functionality of strip_tags() by giving single quoted strings as values for $str argument
12*/
13
14echo "*** Testing strip_tags() : usage variations ***\n";
15
16
17$single_quote_string = array (
18  '<html> \$ -> This represents the dollar sign</html><?php echo hello ?>',
19  '<html>\t\r\v The quick brown fo\fx jumped over the lazy dog</p>',
20  '<a>This is a hyper text tag</a>',
21  '<? <html>hello world\\t</html>?>',
22  '<p>This is a paragraph</p>',
23  '<b>This is \ta text in bold letters\r\s\malong with slashes\n</b>'
24);
25
26$quotes = "<html><a><p><b><?php";
27
28//loop through the various elements of strings array to test strip_tags() functionality
29$iterator = 1;
30foreach($single_quote_string 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(51) "<html> \$ -> This represents the dollar sign</html>"
43-- Iteration 2 --
44string(63) "<html>\t\r\v The quick brown fo\fx 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(65) "<b>This is \ta text in bold letters\r\s\malong with slashes\n</b>"
53Done
54