|
Posted by alexandis on 11/26/07 00:13
I have the following multi array like this:
[0] => [ [0] => "A", [1] => "B", [2] => "C" ]
[1] => [ [0] => "A", [1] => "C", [2] => "D" ]
[2] => [ [0] => "B", [1] => "A", [2] => "B" ]
[3] => [ [0] => "B", [1] => "A", [2] => "D" ]
It should be transformed into this:
["A"] => [
["B"] => [
"C"
],
["C"] => [
"D"
]
],
["B"] => [
["A"] => [
"B", "D"
]
]
- that is to say, i need to split the above structure into classes,
subclasses, subsubclasses and so on, depth is variable...
I thought about recursive function, but can't figure out how it should
look like. Was fighting whole day over this task, but vain... :(
Navigation:
[Reply to this message]
|