I have the following url /dir1/dir2/page.php
I need to generate a an array of the parent->child relation form the above url.
/dir1
|
|
/dir2/
|
|
page.php
eg :
array('dir1'=> array(
'child' => array( 'dir2' => array(
'child' => array(
'page' => array())))));
I tried using the recursive function but not able to figure out the logic.
Please let me know if you need some more explanation.
Here’s a recursive method (sorry for lack of comments, it’s late):
It prints out: