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