I have the next multi dimensional array:
Array
(
[0] => Array
(
[id] => 1
[name] => Category 1
[parent] => 0
[children] => Array
(
[0] => Array
(
[id] => 3
[name] => Sub 1
[parent] => 1
[children] => Array
(
)
)
[1] => Array
(
[id] => 4
[name] => Sub 2
[parent] => 1
[children] => Array
(
[0] => Array
(
[id] => 6
[name] => Sub Sub 4
[parent] => 4
[children] => Array
(
)
)
)
)
)
)
[1] => Array
(
[id] => 2
[name] => Category 2
[parent] => 0
[children] => Array
(
[0] => Array
(
[id] => 5
[name] => Sub 3
[parent] => 2
[children] => Array
(
)
)
)
)
)
I need to render this array on page with different indents. For example:
- Category 1
- Sub 1
- Sub 2
- Sub Sub 4
- Category 2
- Sub 3
I know that I can use SPL RecursiveArrayIterator for it, but I dont'know how. Can you help me with it, how to render array like this?