2
Test array_chunk() function : basic functionality - defualt 'preserve_keys'
5
/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
6
* Description: Split array into chunks
7
* Chunks an array into size large chunks.
8
* Source code: ext/standard/array.c
11
echo "*** Testing array_chunk() : basic functionality ***\n";
14
$input_arrays = array (
15
// array with default keys - numeric values
18
// array with default keys - string values
19
array('value1', "value2", "value3"),
21
// associative arrays - key as string
22
array('key1' => 1, "key2" => 2, "key3" => 3),
24
// associative arrays - key as numeric
25
array(1 => 'one', 2 => "two", 3 => "three"),
27
// array containing elements with/witout keys
28
array(1 => 'one','two', 3 => 'three', 4, "five" => 5)
33
// loop through each element of the array for input
34
foreach ($input_arrays as $input_array){
35
echo "\n-- Iteration $count --\n";
36
var_dump( array_chunk($input_array, $size) );
43
*** Testing array_chunk() : basic functionality ***