1--TEST--
2Test nl2br() function : usage variations - heredoc strings for 'str' argument
3--FILE--
4<?php
5/* Test nl2br() function by passing heredoc strings containing various
6 *   combinations of new line chars to 'str' argument
7*/
8
9echo "*** Testing nl2br() : usage variations ***\n";
10//heredoc string containing new line chars(\n, \r and combinations of \r & \n) and new lines
11$heredoc_str1 = <<<EOD
12\n
13\r
14\r\n
15\nnn\n\n\nn
16\rrr\r\r\rr
17\n\r\n\r\r\n\nr\rn
18EOD;
19
20//heredoc string containing embedded 'new line chars'/'new lines' in the string
21$heredoc_str2 = <<<EOD
22Hello\nWorld\r
23This is \tes\t for \n \new lines
24like \n \r\n \r \n\r and etc
25EOD;
26
27var_dump(nl2br($heredoc_str1) );
28var_dump(nl2br($heredoc_str2) );
29
30echo "Done";
31?>
32--EXPECT--
33*** Testing nl2br() : usage variations ***
34string(147) "<br />
35<br />
36
36<br />
37
37<br />
38<br />
39<br />
40nn<br />
41<br />
42<br />
43n<br />
44
44rr<br />
44<br />
44<br />
44r<br />
45<br />
46
46<br />
47
47<br />
48<br />
49r<br />
49n"
50string(118) "Hello<br />
51World<br />
52This is 	es	 for <br />
53 <br />
54ew lines<br />
55like <br />
56 <br />
57 <br />
57 <br />
58
58 and etc"
59Done
60