Re: Re[2]: [PHP] split array in 2 halfs

2001-10-31 Thread Liz Fulghum
Correction: $count = count($array); $count = $count/2; $count = round($count,0); "Liz Fulghum" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > You could also grab the midpoint of the array: > > $count = round(count($array), 0); > > then populate your new arra

Re: Re[2]: [PHP] split array in 2 halfs

2001-10-31 Thread Philip Olson
You may find this helpful: $arr = array('a','b','c','d','e'); $second_half = array_splice($arr,floor(sizeof($arr)/2)); print_r($arr); // Array ( [0] => a [1] => b ) print_r($second_half); // Array ( [0] => c [1] => d [2] => e ) In the above, $second_half will be one la

Re: Re[2]: [PHP] split array in 2 halfs

2001-10-31 Thread Liz Fulghum
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++; } "D

Re: Re[2]: [PHP] split array in 2 halfs

2001-10-31 Thread DL Neil
Or do you really want: First array: 1 3 5 Second array 2 4 6 Corresponding to the two columns across the screen, and controlled by the same iteration index? =dn - Original Message - From: "Daniel Harik" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: 01 November 2001 07:25 Subject:

Re: Re[2]: [PHP] split array in 2 halfs

2001-10-31 Thread Jim Lucas
take a look at the manual http://www.php.net/manual/en/function.array-slice.php it will show you the right way to do it jim - Original Message - From: "Daniel Harik" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 31, 2001 11:25 PM Subject: Re[2]: [PHP] split arra