Good day.
Can you please tell us how to use your function in CodeIgniter in the template itself? I understand that this is not beautiful and not correct, but otherwise you will have to disassemble an array of this type:
category1
---- category 2
----- category 3
------ category4
------- category 5
And then again to collect in the same form, but with the addition of additional. key to each array. Tried to register $this->myfunct($id)
did not work.