I\'m looking to take a string such as
\"/test/uri/to/heaven\"
and turn it into a multi-dimensional, nested array such as:
a
Here is a quick non recursive hack:
$url = "/test/uri/to/heaven";
$parts = explode('/',$url);
$arr = array();
while ($bottom = array_pop($parts)) {
$arr = array($bottom => $arr);
}
var_dump($arr);
Output:
array(1) {
["test"]=>
array(1) {
["uri"]=>
array(1) {
["to"]=>
array(1) {
["heaven"]=>
array(0) {
}
}
}
}
}