More generally, this should work:

$smallarray1=array_slice($bigarray, 0, sizeof($bigarray) / 2);
$smallarray2=array_slice($bigarray, sizeof($bigarray) / 2);

I haven't tested it though...

-----Original Message-----
From: Mark [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 31, 2001 4:32 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re[3]: [PHP] split array in 2 halfs


$smallarray1=array_slice($bigarray,0,3);
$smallarray2=array_slice($bigarray,3,3);

On Wed, 31 Oct 2001 23:25:55 -0800, Daniel Harik wrote:
>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
>
>


-- 
Mark, [EMAIL PROTECTED] on 10/31/2001



-- 
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]


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