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);

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
 

Find me on

My tweets