xref: /PHP-7.4/ext/standard/tests/strings/nl2br.phpt (revision 782352c5)
1--TEST--
2nl2br() function
3--FILE--
4<?php
5	var_dump(nl2br("test"));
6	var_dump(nl2br(""));
7	var_dump(nl2br(NULL));
8	var_dump(nl2br("\r\n"));
9	var_dump(nl2br("\n"));
10	var_dump(nl2br("\r"));
11	var_dump(nl2br("\n\r"));
12
13	var_dump(nl2br("\n\r\r\n\r\r\r\r"));
14	var_dump(nl2br("\n\r\n\n\r\n\r\r\n\r\n"));
15	var_dump(nl2br("\n\r\n\n\n\n\r\r\r\r\n\r"));
16
17?>
18--EXPECT--
19string(4) "test"
20string(0) ""
21string(0) ""
22string(8) "<br />
23"
24string(7) "<br />
25"
26string(7) "<br />
26"
27string(8) "<br />
28
28"
29string(44) "<br />
30
30<br />
31<br />
31<br />
31<br />
31<br />
31"
32string(47) "<br />
33
33<br />
34<br />
35
35<br />
36
36<br />
37<br />
38"
39string(66) "<br />
40
40<br />
41<br />
42<br />
43<br />
44
44<br />
44<br />
44<br />
45<br />
45"
46