I have a rather large array that contains data for all of the forums on a message board, unfortunately I am running into an issue where I am having repeat entries for some keys. The array is ordered in an hierarchy by parents, which is why it gets deep at some points.
Array
(
[0] => Array
(
[cat_data] => Array()
[forum_data] => Array
(
[2] => Array
(
[subforums] => Array
(
[6] => Array
(
[subforums] => Array
(
[15] => Array()
[16] => Array()
)
)
[7] => Array()
[15] => Array()
[16] => Array()
)
)
[3] => Array()
)
)
)
The subforums on the forum id 6 are repeated as subforums for forum id 2. I need to remove the repeated keys that are in the lowest level of the array. So in this example, I would like to keep 15 and 16 as subs of 6 but remove them as subs of 2.
Just a note, I am writing an application for the board, I am not generating the array, it is generated by the board, that is why I can't remove the duplicates while the array is being created.
Thank you all for your help.