Split an array into chunks of two:
The array_chunk() function splits an array into chunks of new arrays.
Parameter | Description |
---|---|
array | Required. Specifies the array to use |
size | Required. An integer that specifies the size of each chunk |
preserve_key | Optional. Possible values:
|
Return Value: | Returns a multidimensional indexed array, starting with zero, with each dimension containing size elements |
---|---|
PHP Version: | 4.2+ |
Split an array into chunks of two and preserve the original keys: