PHP Multidimensional array to unordered list, building up url path
I have a multidimensional array in PHP produced by the great examples of icio and ftrotter (I am use ftrotterrs array in arrays variant): Turn database result into array I have made this into a unordered list width this method: public function outputCategories($categories, $startingLevel = 0) { echo "<ul>\n"; foreach ($categories as $key => $category) { if (count($category['children']) > 0) { echo "<li>{$category['menu_nl']}\n"; $this->outputCategories($category['children'], $link , $start, $startingLevel+1); echo "</li>\n"; } else { echo "<li>{$category['menu_nl']}</li>\n"; } } echo "</ul>\n"