Hi. I got a pretty big issue with an array here. As you can see below (a print_r of an array) they have an id/parent_id relationship. This array I'd like to print as a tree function.
The problem is this: I want to remove a "branch" from the array.
Let's say I'd like to remove ID 2 (MERCEDES). Then, sing a recursive function, MERCEDES RUBBERS (3) should be removed, etc.
I don't know how to "cut" one array element out of the rest and end up with an array without the branch.
Thank you!!!!!
Array
(
[0] => Array
(
[parent_id] => 0
[id] => 20
[name] => FIETSEN
[depth] => 1
[selected] => 0
)
[1] => Array
(
[parent_id] => 0
[id] => 23
[name] => AUTO'S
[depth] => 1
[selected] => 0
)
[2] => Array
(
[parent_id] => 23
[id] => 2
[name] => MERCEDES
[depth] => 2
[selected] => 0
)
[3] => Array
(
[parent_id] => 2
[id] => 3
[name] => MERCEDES RUBBERS
[depth] => 3
[selected] => 0
)
[4] => Array
(
[parent_id] => 23
[id] => 1
[name] => VOLVO
[depth] => 2
[selected] => 1
)
[5] => Array
(
[parent_id] => 1
[id] => 25
[name] => VOLVO ONDERDELEN
[depth] => 3
[selected] => 0
)
[6] => Array
(
[parent_id] => 1
[id] => 27
[name] => VOLVO 205
[depth] => 3
[selected] => 0
)
[7] => Array
(
[parent_id] => 0
[id] => 26
[name] => MOTOREN
[depth] => 1
[selected] => 0
)
)