Convert Array to Multidimensional Array
- by Tim
I like to convert a single array into a multidimensional array. This is what I get have web scraping a page, except it is not the end result that I am looking for.
Change:
Rooms: Array (
[0] => name
[1] => value
[2] => size
[3] =>
[4] => name
[5] => value
[6] => size
[7] =>
[8] => name
[9] => value
[10] => size
[11] =>
[12] => name
[13] => value
[14] => size
[15] =>
)
Into:
Rooms: Array (
Room: Array (
[0] => name
[1] => value
[2] => size
),
Room: Array (
[0] => name
[1] => value
[2] => size
),
Room: Array (
[0] => name
[1] => value
[2] => size
)
)