RE: Re[3]: [PHP] split array in 2 halfs
| From: | Matthew Loff | Date: | Wed, 31 Oct 2001 22:48:49 +0000 |
| Subject: | RE: Re[3]: [PHP] split array in 2 halfs | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73086@lists.php.net to get a copy of this message | ||
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:maggelet@mminternet.com]
Sent: Wednesday, October 31, 2001 4:32 PM
To: gatop@hot.ee; php-general@lists.php.net
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, maggelet@mminternet.com on 10/31/2001
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net