1--TEST--
2Test strip_tags() function : usage variations - single 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 single quoted strings as values for $str argument
14*/
15
16echo "*** Testing strip_tags() : usage variations ***\n";
17
18
19$single_quote_string = array (
20  '<html> \$ -> This represents the dollar sign</html><?php echo hello ?>',
21  '<html>\t\r\v The quick brown fo\fx jumped over the lazy dog</p>',
22  '<a>This is a hyper text tag</a>',
23  '<? <html>hello world\\t</html>?>',
24  '<p>This is a paragraph</p>',
25  '<b>This is \ta text in bold letters\r\s\malong with slashes\n</b>'
26);
27
28$quotes = "<html><a><p><b><?php";
29
30//loop through the various elements of strings array to test strip_tags() functionality
31$iterator = 1;
32foreach($single_quote_string as $string_value)
33{
34      echo "-- Iteration $iterator --\n";
35      var_dump( strip_tags($string_value, $quotes) );
36      $iterator++;
37}
38
39echo "Done";
40?>
41--EXPECTF--
42*** Testing strip_tags() : usage variations ***
43-- Iteration 1 --
44string(51) "<html> \$ -> This represents the dollar sign</html>"
45-- Iteration 2 --
46string(63) "<html>\t\r\v The quick brown fo\fx jumped over the lazy dog</p>"
47-- Iteration 3 --
48string(31) "<a>This is a hyper text tag</a>"
49-- Iteration 4 --
50string(0) ""
51-- Iteration 5 --
52string(26) "<p>This is a paragraph</p>"
53-- Iteration 6 --
54string(65) "<b>This is \ta text in bold letters\r\s\malong with slashes\n</b>"
55Done
56