array_chunk

It splits an array into chunks

Example

<?php
echo “<pre>”;
$array = array(‘a’, ‘b’, ‘c’, ‘d’, ‘e’);
print_r(array_chunk($array, 3));
?>

Output

Array
(
[0] => Array
(
[0] => a
[1] => b
[2] => c
)

[1] => Array
(
[0] => d
[1] => e
)

)

Share