Answer the question
In order to leave comments, you need to log in
How to recurse a multi-level menu from an array?
There is an array of this kind.
How to display a multi-level menu with a recursive function? I tried to figure it out, but I don't understand how to implement it.
$cat = [
['id' => 1, 'parentid' => 0, 'name' => 'programming languages'],
['id' => 3, 'parentid' => 1, 'name' => 'php'],
['id' => 4, 'parentid' => 1, 'name' => 'javascript'],
['id' => 7, 'parentid' => 4, 'name' => 'jquery'],
['id' => 8, 'parentid' => 1, 'name' => 'jqueryUI'],
['id' => 10, 'parentid' => 8, 'name' => 'datePicker'],
['id' => 11, 'parentid' => 10, 'name' => 'time'],
['id' => 12, 'parentid' => 10, 'name' => 'date'],
['id' => 13, 'parentid' => 1, 'name' => 'ruby'],
];
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