troubleshooting Question

Splitting a Multidimensional Array into Halves

Avatar of bergstrom_davin
bergstrom_davin asked on
PHPScripting Languages
2 Comments1 Solution184 ViewsLast Modified:
How can you find the mid point of an array. I would like to split an multidimensional array into half.

I have an array of arrays as below that I would like to create two chunks of nested lists as follows.

ARRAY ONE
Folder A
  File 1
  File 2
  File 3

Folder B
  File 4

Folder C

Folder D
  File 5
  File 6
  File 7

I would like to split it by number of files without breaking a folder up.
ARRAY ONE            ARRAY TWO
Folder A            Folder C
  File 1
  File 2            Folder D
  File 3              File 5
              File 6
Folder B              File 7
  File 4
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros