You could also grab the midpoint of the array:

$count = round(count($array), 0);

then populate your new arrays by using a foreach loop:

$x = 0;
foreach($array as $key => $value) {
    if ($x <=$count) {
        $array1[] = $value;
    } else {
        $array2[] = $value;
    }
    $x++;
}



"Daniel Harik" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Want to split it in half
>
> 1 Big array:
>
> 1
> 2
> 3
> 4
> 5
> 6
>
> Want to make
>
>
> 1 Small array:
>
> 1
> 2
> 3
>
> 2 Small array:
> 4
> 5
> 6
>
> Thank You
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to