PHP Dynamically adding dimensions to an array using for loop

pilupj5wek

New Member
Here is my dilemma and thank you in advance!I am trying to create a variable variable or something of the sort for a dynamic associative array and having a hell of a time figuring out how to do this. I am creating a file explorer so I am using the directories as the keys in the array.Example:
I need to get this so I can assign it values\[code\]$dir_list['root']['folder1']['folder2'] = value;\[/code\]so I was thinking of doing something along these lines...\[code\]if ( $handle2 = @opendir( $theDir.'/'.$file )){ $tmp_dir_url = explode($theDir); for ( $k = 1; $k < sizeof ( $tmp_dir_url ); $k++ ) { $dir_list [ $dir_array [ sizeof ( $dir_array ) - 1 ] ][$tmp_dir_url[$k]] }\[/code\]this is where I get stuck, I need to dynamically append a new dimension to the array durring each iteration through the for loop...but i have NO CLUE how
 
Back
Top