<?php $array1 = array('a', 'b', 'c', 'd', 'e'); print_r(array_chunk($array1, 2)); print_r(array_chunk($array1, 2, true));?>
Standard input is empty
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 ) )
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!