Well I was curious to see if I could do this, and the method that I came up with is... well, rather odd (I had to use eval() to start with). Here's the code:
foreach($array as $key => $value) {
unset($array[$key]);
eval('$array['.$key.']' . makeArray($value) . ' = NULL;');
}
function makeArray($value) {
$arrays = array_filter(explode('/', $value));
for($i=reset($arrays), $tmp=''; $i !== FALSE; $i=next($arrays))
$tmp .= "['$i']";
return $tmp;
}
and with your example array, this is the output:
Array
(
[0] => Array
(
[fol1_level1] =>
)
[1] => Array
(
[fol1_level1] => Array
(
[fol1_level2] =>
)
)
[2] => Array
(
[fol1_level1] => Array
(
[fol1_level2] => Array
(
[fol1_level3] =>
)
)
)
[3] => Array
(
[fol2_level1] =>
)
[4] => Array
(
[fol2_level1] => Array
(
[fol2_level2] =>
)
)
)