|
Oh yay I hate writing recursive arrays as trees.
You *can* also let the function completely flatten the dataset of the $menu array if desired. Ultimately if I do a tree with arrays in PHP, I'd have two functions anyway, the first one would build the correct nesting level for the items, and the second to display it (both accept the same dataset). That is similarish to what you've done here with the two items in the $menu pulled from the fetch.
|