Answer the question
In order to leave comments, you need to log in
How to implement recursive getting values of a multidimensional (tree) array?
I implement in one application the function of viewing the report. For employees who do not have subordinates - you can view the report only for yourself, for those who have subordinates - give the choice to view a report on them.
Employees are divided into departments and each department has a leader.
An example of displaying data (in what form the database returns them):
UF_HEAD - ID of the head of the department
ID - ID of the department
PARENT - parent of the department
[0] => Array
(
[ID] => 1
[NAME] => Рога и копыта
[UF_HEAD] => 40
)
[1] => Array
(
[ID] => 86
[NAME] => Рога
[PARENT] => 1
[UF_HEAD] => 88
)
[2] => Array
(
[ID] => 72
[NAME] => Копыта
[PARENT] => 1
[UF_HEAD] => 88
)
[3] => Array
(
[ID] => 55
[NAME] => Рожки
[PARENT] => 86
[UF_HEAD] => 70
)
[1] => Array
(
[ID] => 1
[NAME] => Рога и копыта
[UF_HEAD] => 40
[CHILDS] =>
Array
(
[86] => Array
(
[ID] => 86
[NAME] => Рога
[PARENT] => 1
[UF_HEAD] => 88
[CHILDS] => Array
(
[55] => Array
(
[ID] => 55
[NAME] => Рожки
[PARENT] => 86
[UF_HEAD] => 70
)
)
)
[72] => Array
(
[ID] => 72
[NAME] => Копыта
[PARENT] => 1
[UF_HEAD] => 88
)
)
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question