Convert Array to Multidimensional Array
Posted
by
Tim
on Stack Overflow
See other posts from Stack Overflow
or by Tim
Published on 2011-02-06T23:13:03Z
Indexed on
2011/02/06
23:25 UTC
Read the original article
Hit count: 186
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
)
)
© Stack Overflow or respective owner