...

View Full Version : coverting "." serparated string to an array ??



PHPycho
03-11-2008, 11:23 AM
Hello forums!!
Suppose we had list of strings in an array in a hierarchical form(separated by ".") as follows:

FOLDER1
FOLDER1.subfolder1
FOLDER1.subfolder2
FOLDER1.subfolder2.sub_subfolder1
FOLDER1.subfolder2.sub_subfolder12
.. can go upto n levels
FOLDER2
FOLDER2.subfolder1

I want to convert such string in an array , For example

array("FOLDER1" => array("subfolder1", "subfolder2" => array("sub_subfolder1","sub_subfolder12"), ...), "FOLDER2" => array("subfolder1"), ...etc)
How to accomplish this as it seems to be recursive.
Thanks in advance for the valueable tips and suggestions.

Rohan_Shenoy
03-12-2008, 02:38 PM
http://in2.php.net/manual/en/function.array-walk-recursive.php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum