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