nl2br_variation1.phpt [plain text]
--TEST--
Test nl2br() function : usage variations - double quoted strings for 'str' argument
--FILE--
<?php
echo "*** Testing nl2br() : usage variations ***\n";
$strings = array(
"Hello\nWorld",
"\nHello\nWorld\n",
"Hello\rWorld",
"\rHello\rWorld\r",
"Hello\r\nWorld",
"\r\nHello\r\nWorld\r\n",
"
",
"
",
"Hello
World"
);
$count = 1;
foreach( $strings as $str ){
echo "-- Iteration $count --\n";
var_dump(nl2br($str) );
$count ++ ;
}
echo "Done";
?>
--EXPECTF--
*** Testing nl2br() : usage variations ***
-- Iteration 1 --
string(17) "Hello<br />
World"
-- Iteration 2 --
string(31) "<br />
Hello<br />
World<br />
"
-- Iteration 3 --
string(17) "Hello<br />
World"
-- Iteration 4 --
string(31) "<br />
Hello<br />
World<br />
"
-- Iteration 5 --
string(18) "Hello<br />
World"
-- Iteration 6 --
string(34) "<br />
Hello<br />
World<br />
"
-- Iteration 7 --
string(7) "<br />
"
-- Iteration 8 --
string(14) "<br />
<br />
"
-- Iteration 9 --
string(17) "Hello<br />
World"
Done