PHP

Split array in smaller arrays

PHP iconTo divide an array and split it into smaller sub-arrays by size, you can use the PHP function array_chunk():

$sections = array_chunk(array('k', 'l', 'm', 'n', 'o'), 2);