how to merge multiple url/path into multidimensional array ?
- by KelNoReem
I have array like this:
$path = array (
[0] => site\projects\terrace_and_balcony\mexico.jpg
[1] => site\projects\terrace_and_balcony\new_york.jpg
[2] => site\projects\terrace_and_balcony\berlin.jpg
[3] => site\projects\terrace_and_balcony\Kentucky.jpg
[4] => site\projects\terrace_and_balcony\Utah.jpg
[5] => site\projects\terrace_and_balcony\Hawaii.jpg
[6] => site\projects\private_gardens\mexico.jpg
[7] => site\projects\private_gardens\new_york.jpg
[8] => site\projects\private_gardens\berlin.jpg
[9] => site\projects\private_gardens\Kentucky.jpg
[10] => site\projects\private_gardens\Utah.jpg
[11] => site\projects\private_gardens\Hawaii.jpg
)
How to convert it to that:
$path11 = array
(
"site"=>array
(
"projects"=>array
(
"terrace_and_balcony"=>array
(
"mexico.jpg",
"new_york.jpg",
"berlin.jpg",
"Kentucky.jpg",
"Utah.jpg",
"Hawaii.jpg"
),
"private_gardens"=>array
(
"mexico.jpg",
"new_york.jpg",
"berlin.jpg",
"Kentucky.jpg",
"Utah.jpg",
"Hawaii.jpg"
)
)
)
);