Function __global->array_chunk
Definitions
sources_custom/phpstub.php
- Split an array into chunks.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: array
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $input | array | No | No | required parameter | N/A | N/A | The array to work on |
| $size | integer | No | No | required parameter | N/A | N/A | The size of each chunk |
| $preserve_keys | boolean | No | No | False | N/A | N/A | When set to TRUE keys will be preserved. Default is FALSE which will reindex the chunk numerically. |
Returns
- A multidimensional numerically indexed array, starting with zero, with each dimension containing size elements
- Type: array
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Split an array into chunks.
*
* @param array $input The array to work on
* @param integer $size The size of each chunk
* @param boolean $preserve_keys When set to TRUE keys will be preserved. Default is FALSE which will reindex the chunk numerically.
* @return array A multidimensional numerically indexed array, starting with zero, with each dimension containing size elements
*/
function array_chunk(array $input, int $size, bool $preserve_keys = false) : array
* Split an array into chunks.
*
* @param array $input The array to work on
* @param integer $size The size of each chunk
* @param boolean $preserve_keys When set to TRUE keys will be preserved. Default is FALSE which will reindex the chunk numerically.
* @return array A multidimensional numerically indexed array, starting with zero, with each dimension containing size elements
*/
function array_chunk(array $input, int $size, bool $preserve_keys = false) : array

