Jump to content

[SOLVED] splitting array


dose

Recommended Posts

<?php
$a = '1 2 3 4 5 6 7 8 9 10 11 12 13 14';
$split = explode(' ', $a);
for($i = 0;$i < count($split);$i += 5)
$arrays[] = array_slice($split, $i, 5);

then $arrays will contain all the arrays that you want. So $arrays[0] would be an array containing the numbers 1-5, etc..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.