2 Test nl2br() function : usage variations - double quoted strings for 'str' argument
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
10 /* Test nl2br() function by passing double quoted strings containing various
11 * combinations of new line chars to 'str' argument
14 echo "*** Testing nl2br() : usage variations ***\n";
17 //new line chars embedded in strings
23 "\r\nHello\r\nWorld\r\n",
34 //inserted new line in a string
39 //loop through $strings array to test nl2br() function with each element
41 foreach( $strings as $str ){
42 echo "-- Iteration $count --\n";
43 var_dump(nl2br($str) );
49 *** Testing nl2br() : usage variations ***
51 string(17) "Hello<br />
59 string(17) "Hello<br />
\rWorld"
61 string(31) "<br />
\rHello<br />
\rWorld<br />
\r"
63 string(18) "Hello<br />
78 string(17) "Hello<br />