1--TEST--
2Test strip_tags() function : usage variations - heredoc 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/*
12 * testing functionality of strip_tags() by giving heredoc strings as values for $str argument
13*/
14
15echo "*** Testing strip_tags() : usage variations ***\n";
16
17// null here doc string
18$null_string = <<<EOT
19EOT;
20
21// heredoc string with blank line
22$blank_line = <<<EOT
23
24EOT;
25
26// here doc with multiline string
27$multiline_string = <<<EOT
28<html>hello world</html>
29<p>13 &lt; 25</p>
30<?php 1111 &amp; 0000 = 0000 ?>
31<b>This is a double quoted string</b>
32EOT;
33
34// here doc with different whitespaces
35$diff_whitespaces = <<<EOT
36<html>hello\r world\t
371111\t\t != 2222\v\v</html>
38<? heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces ?>
39EOT;
40
41// here doc with numeric values
42$numeric_string = <<<EOT
43<html>11 < 12. 123 >22</html>
44<p>string</p> 1111\t <b>0000\t = 0000\n</b>
45EOT;
46
47// heredoc with quote chars & slash
48$quote_char_string = <<<EOT
49<html>This's a string with quotes:</html>
50"strings in double quote";
51'strings in single quote';
52<html>this\line is single quoted /with\slashes </html>
53EOT;
54
55$res_heredoc_strings = array(
56  //heredoc strings
57  $null_string,
58  $blank_line,
59  $multiline_string,
60  $diff_whitespaces,
61  $numeric_string,
62  $quote_char_string
63);
64
65// initialize the second argument
66$quotes = "<html><a><?php";
67
68// loop through $res_heredoc_strings element and check the working on strip_tags()
69$count = 1;
70for($index =0; $index < count($res_heredoc_strings); $index ++) {
71  echo "-- Iteration $count --\n";
72  var_dump( strip_tags($res_heredoc_strings[$index], $quotes) );
73  $count++;
74}
75
76echo "Done\n";
77?>
78--EXPECT--
79*** Testing strip_tags() : usage variations ***
80-- Iteration 1 --
81string(0) ""
82-- Iteration 2 --
83string(0) ""
84-- Iteration 3 --
85string(67) "<html>hello world</html>
8613 &lt; 25
87
88This is a double quoted string"
89-- Iteration 4 --
90string(44) "<html>hello
90 world
911111		 != 2222</html>
92"
93-- Iteration 5 --
94string(56) "<html>11 < 12. 123 >22</html>
95string 1111	 0000	 = 0000
96"
97-- Iteration 6 --
98string(150) "<html>This's a string with quotes:</html>
99"strings in double quote";
100'strings in single quote';
101<html>this\line is single quoted /with\slashes </html>"
102Done
103