|
Posted by Ben-Nes Yonatan on 07/11/05 20:56
Hi all!
I got a string which include information for categories that I need to
build, the string is built like this:
$string = "val1~~val2~~val3~~val4~~val5"
Now, I want to create from this string a multi dimensional array and not
one dimension array as explode('~~', $string) will give me.
The desired result from this string is:
$array['val1'] = 'whatever';
$array['val1']['val2'] = 'whatever';
$array['val1']['val2']['val3'] = 'whatever';
$array['val1']['val2']['val3']['val4'] = 'whatever';
$array['val1']['val2']['val3']['val4']['val'5] = 'whatever';
My problem is that the number of the dimensions is really unknown and
can be changed from 1 to 20 as far as I know.
Is there a way to create such a dynamic depth in an automatic way and
not by using lots of if's?
Thanks in advance,
Ben-Nes Yonatan
Canaan Surfing Ltd.
Navigation:
[Reply to this message]
|