fork(2) download
  1. <?php
  2. $array1 = array('a', 'b', 'c', 'd', 'e');
  3. print_r(array_chunk($array1, 2));
  4. print_r(array_chunk($array1, 2, true));
  5. ?>
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => a
            [1] => b
        )

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

    [2] => Array
        (
            [0] => e
        )

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

    [1] => Array
        (
            [2] => c
            [3] => d
        )

    [2] => Array
        (
            [4] => e
        )

)