1--TEST--
2basic array_chunk test
3--FILE--
4<?php
5$input_array = array('a', 'b', 'c', 'd', 'e');
6
7try {
8    var_dump(array_chunk($input_array, 0));
9} catch (\ValueError $e) {
10    echo $e->getMessage() . "\n";
11}
12
13try {
14    var_dump(array_chunk($input_array, 0, true));
15} catch (\ValueError $e) {
16    echo $e->getMessage() . "\n";
17}
18
19var_dump(array_chunk($input_array, 1));
20var_dump(array_chunk($input_array, 1, true));
21var_dump(array_chunk($input_array, 2));
22var_dump(array_chunk($input_array, 2, true));
23var_dump(array_chunk($input_array, 10));
24var_dump(array_chunk($input_array, 10, true));
25?>
26--EXPECT--
27array_chunk(): Argument #2 ($length) must be greater than 0
28array_chunk(): Argument #2 ($length) must be greater than 0
29array(5) {
30  [0]=>
31  array(1) {
32    [0]=>
33    string(1) "a"
34  }
35  [1]=>
36  array(1) {
37    [0]=>
38    string(1) "b"
39  }
40  [2]=>
41  array(1) {
42    [0]=>
43    string(1) "c"
44  }
45  [3]=>
46  array(1) {
47    [0]=>
48    string(1) "d"
49  }
50  [4]=>
51  array(1) {
52    [0]=>
53    string(1) "e"
54  }
55}
56array(5) {
57  [0]=>
58  array(1) {
59    [0]=>
60    string(1) "a"
61  }
62  [1]=>
63  array(1) {
64    [1]=>
65    string(1) "b"
66  }
67  [2]=>
68  array(1) {
69    [2]=>
70    string(1) "c"
71  }
72  [3]=>
73  array(1) {
74    [3]=>
75    string(1) "d"
76  }
77  [4]=>
78  array(1) {
79    [4]=>
80    string(1) "e"
81  }
82}
83array(3) {
84  [0]=>
85  array(2) {
86    [0]=>
87    string(1) "a"
88    [1]=>
89    string(1) "b"
90  }
91  [1]=>
92  array(2) {
93    [0]=>
94    string(1) "c"
95    [1]=>
96    string(1) "d"
97  }
98  [2]=>
99  array(1) {
100    [0]=>
101    string(1) "e"
102  }
103}
104array(3) {
105  [0]=>
106  array(2) {
107    [0]=>
108    string(1) "a"
109    [1]=>
110    string(1) "b"
111  }
112  [1]=>
113  array(2) {
114    [2]=>
115    string(1) "c"
116    [3]=>
117    string(1) "d"
118  }
119  [2]=>
120  array(1) {
121    [4]=>
122    string(1) "e"
123  }
124}
125array(1) {
126  [0]=>
127  array(5) {
128    [0]=>
129    string(1) "a"
130    [1]=>
131    string(1) "b"
132    [2]=>
133    string(1) "c"
134    [3]=>
135    string(1) "d"
136    [4]=>
137    string(1) "e"
138  }
139}
140array(1) {
141  [0]=>
142  array(5) {
143    [0]=>
144    string(1) "a"
145    [1]=>
146    string(1) "b"
147    [2]=>
148    string(1) "c"
149    [3]=>
150    string(1) "d"
151    [4]=>
152    string(1) "e"
153  }
154}
155