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