1--TEST--
2wordwrap() function
3--FILE--
4<?php
5
6var_dump("12345 12345 12345 12345" === wordwrap("12345 12345 12345 12345"));
7var_dump("12345 12345\n1234567890\n1234567890" === wordwrap("12345 12345 1234567890 1234567890",12));
8var_dump("12345\n12345\n12345\n12345" === wordwrap("12345 12345 12345 12345",0));
9var_dump("12345ab12345ab12345ab12345" === wordwrap("12345 12345 12345 12345",0,"ab"));
10var_dump("12345 12345ab1234567890ab1234567890" === wordwrap("12345 12345 1234567890 1234567890",12,"ab"));
11var_dump("123ab123ab123" === wordwrap("123ab123ab123", 3, "ab"));
12var_dump("123ab123ab123" === wordwrap("123ab123ab123", 5, "ab"));
13var_dump("123ab 123ab123" === wordwrap("123  123ab123", 3, "ab"));
14var_dump("123ab123ab123" === wordwrap("123 123ab123", 5, "ab"));
15var_dump("123 123ab123" === wordwrap("123 123 123", 10, "ab"));
16
17var_dump("123ab123ab123" === wordwrap("123ab123ab123", 3, "ab", 1));
18var_dump("123ab123ab123" === wordwrap("123ab123ab123", 5, "ab", 1));
19var_dump("123ab 12ab3ab123" === wordwrap("123  123ab123", 3, "ab", 1));
20var_dump("123 ab123ab123" === wordwrap("123  123ab123", 5, "ab", 1));
21var_dump("123  123ab 123" === wordwrap("123  123  123", 8, "ab", 1));
22var_dump("123 ab12345 ab123" === wordwrap("123  12345  123", 8, "ab", 1));
23var_dump("1ab2ab3ab4" === wordwrap("1234", 1, "ab", 1));
24
25var_dump("12345|12345|67890" === wordwrap("12345 1234567890", 5, "|", 1));
26
27var_dump("123|==1234567890|==123" === wordwrap("123 1234567890 123", 10, "|==", 1));
28
29
30try {
31    wordwrap(chr(0), 0, "");
32} catch (\ValueError $e) {
33    echo $e->getMessage() . "\n";
34}
35?>
36--EXPECT--
37bool(true)
38bool(true)
39bool(true)
40bool(true)
41bool(true)
42bool(true)
43bool(true)
44bool(true)
45bool(true)
46bool(true)
47bool(true)
48bool(true)
49bool(true)
50bool(true)
51bool(true)
52bool(true)
53bool(true)
54bool(true)
55bool(true)
56wordwrap(): Argument #3 ($break) cannot be empty
57