I get an array of associative arrays of selected company's hierarchy combinations (Some hierarchy levels may be null).
For example, if the hierarchy goes division > department > team:
[
0 => ["division" => "division1"]
1 => ["division" => "division2"]
2 => ["division" => "division1", "department" => "department10"]
3 => ["division" => "division1", "department" => null, "team" => "team91"]
4 => ["division" => "division1", "department" => "department10", "team" => "team85"]
5 => ["division" => "division3", "department" => "department999"]
6 => ["division" => "division2", "department" => "department33"]
7 => ["division" => "division1", "department" => null, "team" => "team92"]
]
I need to reduce it to only arrays containing unique hierarchy combinations, to the lowest hierarchy possible (It might not be the correct phrasing, so if you have a better idea please edit this sentence or let me know what to update it to)
By unique I mean array of unique combinations of hierarchies without subsets of the combinations
The above sample should result in:
[
0 => ["division" => "division1", "department" => null, "team" => "team91"]
1 => ["division" => "division1", "department" => null, "team" => "team92"]
2 => ["division" => "division1", "department" => "department10", "team" => "team85"]
3 => ["division" => "division2", "department" => "department33"]
4 => ["division" => "division3", "department" => "department999"]
]
uniquemore accurately that thisarray_walk_recursivebut it seems inefficient and I'm not sure how to properly use it in this case, if it would work at all