1--TEST--
2Test nl2br() function : usage variations - html values for 'str' argument
3--FILE--
4<?php
5/* Prototype  : string nl2br(string $str)
6 * Description: Inserts HTML line breaks before all newlines in a string.
7 * Source code: ext/standard/string.c
8*/
9
10/*
11* Test nl2br() function by passing html string inputs containing line breaks and
12*   new line chars for 'str'
13*/
14
15echo "*** Testing nl2br() : usage variations ***\n";
16
17//array of html strings
18$strings = array(
19  "<html>Hello<br />world</html>",
20  "<html><br /></html>",
21  "<html>\nHello\r\nworld\r</html>",
22  "<html>\n \r\n \r</html>",
23);
24
25//loop through $strings array to test nl2br() function with each element
26foreach( $strings as $str ){
27  var_dump(nl2br($str) );
28}
29echo "Done";
30?>
31--EXPECT--
32*** Testing nl2br() : usage variations ***
33string(29) "<html>Hello<br />world</html>"
34string(19) "<html><br /></html>"
35string(45) "<html><br />
36Hello<br />
37world<br />
37</html>"
38string(37) "<html><br />
39 <br />
40 <br />
40</html>"
41Done
42