File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
strings /
nl2br_variation4.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:04 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
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";
?>
--EXPECTF--
*** Testing nl2br() : usage variations ***
string(29) "<html>Hello<br />world</html>"
string(19) "<html><br /></html>"
string(45) "<html><br />
Hello<br />
world<br />
</html>"
string(37) "<html><br />
<br />
<br />
</html>"
Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>