array_chunk

Syntax:array array_chunk ( array $input , int $size [, bool $preserve_keys = false ] )
Description:Split an array into chunks

<?php
$input_array = array('a', 'b', 'c');
print_r( array_chunk ( $input_array, 2) );
print_r( array_chunk ( $input_array, 2, true) );
?>
   

OUTPUT

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