php-src/ext/standard/tests/strings/nl2br_variation4.phpt
Steph Fox 87fac43ac0 - killed off UEXPECT
- html_translation_table and setlocale tests are no longer relevant
- there are a number of ANSI-encoded files. Is this deliberate?
2008-05-27 10:50:48 +00:00

44 lines
992 B
PHP

--TEST--
Test nl2br() function : usage variations - html values for 'str' argument
--FILE--
<?php
/* Prototype : string nl2br(string $str)
* Description: Inserts HTML line breaks before all newlines in a string.
* Source code: ext/standard/string.c
*/
/*
* Test nl2br() function by passing html string inputs containing line breaks and
* new line chars for 'str'
*/
echo "*** Testing nl2br() : usage variations ***\n";
//array of html strings
$strings = array(
"<html>Hello<br />world</html>",
"<html><br /></html>",
"<html>\nHello\r\nworld\r</html>",
"<html>\n \r\n \r</html>",
);
//loop through $strings array to test nl2br() function with each element
foreach( $strings as $str ){
var_dump(nl2br($str) );
}
echo "Done";
?>
--EXPECT--
*** Testing nl2br() : usage variations ***
unicode(29) "<html>Hello<br />world</html>"
unicode(19) "<html><br /></html>"
unicode(45) "<html><br />
Hello<br />
world<br />
</html>"
unicode(37) "<html><br />
<br />
<br />
</html>"
Done