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