Trying to create an organizational chart, or nested array, where we have one final array with each person under their supervisor. I am imagining some kind of array walk where a function is called when a condition is met - but unsure how to keep calling the same function when going several relationships deep. Final array should look like:
Array
(
[0] => 1
[1] => Array
(
[0] => 2
[1] => Array
(
[0] => 3
[1] => 4
[2] => 5
[3] => Array
(
[0] => 6
)
)
)
)
personnel_id | personnel_firstname | personnel_supervisor |
---|---|---|
1 | jeff | - |
2 | todd | 1 |
3 | maria | 2 |
4 | john | 2 |
5 | sarah | 2 |
6 | joe | 5 |