I did research on this, and wasn\'t able to find an exact answer. Most of the questions/answers on here pertaining to this seem to be unfinished. If anyone knows of a fini
Here is my solution:
\n", $indent);
$indent = str_repeat(" ", ++$level * 2);
foreach ($items as $item => $subitems) {
if (!is_numeric($item)) {
$ret .= sprintf("%s- %s", $indent, $item);
}
if (is_array($subitems)) {
$ret .= "\n";
$ret .= MakeMenu($subitems, $level + 1);
$ret .= $indent;
} else if (strcmp($item, $subitems)){
$ret .= sprintf("%s
- %s", $indent, $subitems);
}
$ret .= sprintf("
\n", $indent);
}
$indent = str_repeat(" ", --$level * 2);
$ret .= sprintf("%s\n", $indent);
return($ret);
}
$menu = Array(
'home' => Array("sub-home1", "sub-home2"),
'about' => Array("sub-about", "about2" => Array("sub-sub-about")),
'staff' => Array("sub-staff1", "sub-staff2"),
'contact' => "contact"
);
print_r($menu);
echo MakeMenu($menu);
?>