1--TEST-- 2array_chunk() - variation 25 3--FILE-- 4<?php 5$array = array ("p" => "A", "q" => "B", "r" => "C", "s" => "D", "u" => "E", "v" => "F"); 6var_dump ($array); 7for ($i = 0; $i < (sizeof($array) + 1); $i++) { 8 echo "[$i]\n"; 9 var_dump (@array_chunk ($array, $i)); 10 var_dump (@array_chunk ($array, $i, TRUE)); 11 var_dump (@array_chunk ($array, $i, FALSE)); 12 echo "\n"; 13} 14?> 15--EXPECT-- 16array(6) { 17 ["p"]=> 18 string(1) "A" 19 ["q"]=> 20 string(1) "B" 21 ["r"]=> 22 string(1) "C" 23 ["s"]=> 24 string(1) "D" 25 ["u"]=> 26 string(1) "E" 27 ["v"]=> 28 string(1) "F" 29} 30[0] 31NULL 32NULL 33NULL 34 35[1] 36array(6) { 37 [0]=> 38 array(1) { 39 [0]=> 40 string(1) "A" 41 } 42 [1]=> 43 array(1) { 44 [0]=> 45 string(1) "B" 46 } 47 [2]=> 48 array(1) { 49 [0]=> 50 string(1) "C" 51 } 52 [3]=> 53 array(1) { 54 [0]=> 55 string(1) "D" 56 } 57 [4]=> 58 array(1) { 59 [0]=> 60 string(1) "E" 61 } 62 [5]=> 63 array(1) { 64 [0]=> 65 string(1) "F" 66 } 67} 68array(6) { 69 [0]=> 70 array(1) { 71 ["p"]=> 72 string(1) "A" 73 } 74 [1]=> 75 array(1) { 76 ["q"]=> 77 string(1) "B" 78 } 79 [2]=> 80 array(1) { 81 ["r"]=> 82 string(1) "C" 83 } 84 [3]=> 85 array(1) { 86 ["s"]=> 87 string(1) "D" 88 } 89 [4]=> 90 array(1) { 91 ["u"]=> 92 string(1) "E" 93 } 94 [5]=> 95 array(1) { 96 ["v"]=> 97 string(1) "F" 98 } 99} 100array(6) { 101 [0]=> 102 array(1) { 103 [0]=> 104 string(1) "A" 105 } 106 [1]=> 107 array(1) { 108 [0]=> 109 string(1) "B" 110 } 111 [2]=> 112 array(1) { 113 [0]=> 114 string(1) "C" 115 } 116 [3]=> 117 array(1) { 118 [0]=> 119 string(1) "D" 120 } 121 [4]=> 122 array(1) { 123 [0]=> 124 string(1) "E" 125 } 126 [5]=> 127 array(1) { 128 [0]=> 129 string(1) "F" 130 } 131} 132 133[2] 134array(3) { 135 [0]=> 136 array(2) { 137 [0]=> 138 string(1) "A" 139 [1]=> 140 string(1) "B" 141 } 142 [1]=> 143 array(2) { 144 [0]=> 145 string(1) "C" 146 [1]=> 147 string(1) "D" 148 } 149 [2]=> 150 array(2) { 151 [0]=> 152 string(1) "E" 153 [1]=> 154 string(1) "F" 155 } 156} 157array(3) { 158 [0]=> 159 array(2) { 160 ["p"]=> 161 string(1) "A" 162 ["q"]=> 163 string(1) "B" 164 } 165 [1]=> 166 array(2) { 167 ["r"]=> 168 string(1) "C" 169 ["s"]=> 170 string(1) "D" 171 } 172 [2]=> 173 array(2) { 174 ["u"]=> 175 string(1) "E" 176 ["v"]=> 177 string(1) "F" 178 } 179} 180array(3) { 181 [0]=> 182 array(2) { 183 [0]=> 184 string(1) "A" 185 [1]=> 186 string(1) "B" 187 } 188 [1]=> 189 array(2) { 190 [0]=> 191 string(1) "C" 192 [1]=> 193 string(1) "D" 194 } 195 [2]=> 196 array(2) { 197 [0]=> 198 string(1) "E" 199 [1]=> 200 string(1) "F" 201 } 202} 203 204[3] 205array(2) { 206 [0]=> 207 array(3) { 208 [0]=> 209 string(1) "A" 210 [1]=> 211 string(1) "B" 212 [2]=> 213 string(1) "C" 214 } 215 [1]=> 216 array(3) { 217 [0]=> 218 string(1) "D" 219 [1]=> 220 string(1) "E" 221 [2]=> 222 string(1) "F" 223 } 224} 225array(2) { 226 [0]=> 227 array(3) { 228 ["p"]=> 229 string(1) "A" 230 ["q"]=> 231 string(1) "B" 232 ["r"]=> 233 string(1) "C" 234 } 235 [1]=> 236 array(3) { 237 ["s"]=> 238 string(1) "D" 239 ["u"]=> 240 string(1) "E" 241 ["v"]=> 242 string(1) "F" 243 } 244} 245array(2) { 246 [0]=> 247 array(3) { 248 [0]=> 249 string(1) "A" 250 [1]=> 251 string(1) "B" 252 [2]=> 253 string(1) "C" 254 } 255 [1]=> 256 array(3) { 257 [0]=> 258 string(1) "D" 259 [1]=> 260 string(1) "E" 261 [2]=> 262 string(1) "F" 263 } 264} 265 266[4] 267array(2) { 268 [0]=> 269 array(4) { 270 [0]=> 271 string(1) "A" 272 [1]=> 273 string(1) "B" 274 [2]=> 275 string(1) "C" 276 [3]=> 277 string(1) "D" 278 } 279 [1]=> 280 array(2) { 281 [0]=> 282 string(1) "E" 283 [1]=> 284 string(1) "F" 285 } 286} 287array(2) { 288 [0]=> 289 array(4) { 290 ["p"]=> 291 string(1) "A" 292 ["q"]=> 293 string(1) "B" 294 ["r"]=> 295 string(1) "C" 296 ["s"]=> 297 string(1) "D" 298 } 299 [1]=> 300 array(2) { 301 ["u"]=> 302 string(1) "E" 303 ["v"]=> 304 string(1) "F" 305 } 306} 307array(2) { 308 [0]=> 309 array(4) { 310 [0]=> 311 string(1) "A" 312 [1]=> 313 string(1) "B" 314 [2]=> 315 string(1) "C" 316 [3]=> 317 string(1) "D" 318 } 319 [1]=> 320 array(2) { 321 [0]=> 322 string(1) "E" 323 [1]=> 324 string(1) "F" 325 } 326} 327 328[5] 329array(2) { 330 [0]=> 331 array(5) { 332 [0]=> 333 string(1) "A" 334 [1]=> 335 string(1) "B" 336 [2]=> 337 string(1) "C" 338 [3]=> 339 string(1) "D" 340 [4]=> 341 string(1) "E" 342 } 343 [1]=> 344 array(1) { 345 [0]=> 346 string(1) "F" 347 } 348} 349array(2) { 350 [0]=> 351 array(5) { 352 ["p"]=> 353 string(1) "A" 354 ["q"]=> 355 string(1) "B" 356 ["r"]=> 357 string(1) "C" 358 ["s"]=> 359 string(1) "D" 360 ["u"]=> 361 string(1) "E" 362 } 363 [1]=> 364 array(1) { 365 ["v"]=> 366 string(1) "F" 367 } 368} 369array(2) { 370 [0]=> 371 array(5) { 372 [0]=> 373 string(1) "A" 374 [1]=> 375 string(1) "B" 376 [2]=> 377 string(1) "C" 378 [3]=> 379 string(1) "D" 380 [4]=> 381 string(1) "E" 382 } 383 [1]=> 384 array(1) { 385 [0]=> 386 string(1) "F" 387 } 388} 389 390[6] 391array(1) { 392 [0]=> 393 array(6) { 394 [0]=> 395 string(1) "A" 396 [1]=> 397 string(1) "B" 398 [2]=> 399 string(1) "C" 400 [3]=> 401 string(1) "D" 402 [4]=> 403 string(1) "E" 404 [5]=> 405 string(1) "F" 406 } 407} 408array(1) { 409 [0]=> 410 array(6) { 411 ["p"]=> 412 string(1) "A" 413 ["q"]=> 414 string(1) "B" 415 ["r"]=> 416 string(1) "C" 417 ["s"]=> 418 string(1) "D" 419 ["u"]=> 420 string(1) "E" 421 ["v"]=> 422 string(1) "F" 423 } 424} 425array(1) { 426 [0]=> 427 array(6) { 428 [0]=> 429 string(1) "A" 430 [1]=> 431 string(1) "B" 432 [2]=> 433 string(1) "C" 434 [3]=> 435 string(1) "D" 436 [4]=> 437 string(1) "E" 438 [5]=> 439 string(1) "F" 440 } 441} 442