Annotation of embedaddon/php/ext/standard/tests/strings/nl2br_variation4.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test nl2br() function : usage variations - html values for 'str' argument
3: --FILE--
4: <?php
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
8: */
9:
10: /*
11: * Test nl2br() function by passing html string inputs containing line breaks and
12: * new line chars for 'str'
13: */
14:
15: echo "*** Testing nl2br() : usage variations ***\n";
16:
17: //array of html strings
18: $strings = array(
19: "<html>Hello<br />world</html>",
20: "<html><br /></html>",
21: "<html>\nHello\r\nworld\r</html>",
22: "<html>\n \r\n \r</html>",
23: );
24:
25: //loop through $strings array to test nl2br() function with each element
26: foreach( $strings as $str ){
27: var_dump(nl2br($str) );
28: }
29: echo "Done";
30: ?>
31: --EXPECTF--
32: *** Testing nl2br() : usage variations ***
33: string(29) "<html>Hello<br />world</html>"
34: string(19) "<html><br /></html>"
35: string(45) "<html><br />
36: Hello<br />
37: world<br />
</html>"
38: string(37) "<html><br />
39: <br />
40: <br />
</html>"
41: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>