L'ho buttata lì.
codice:
<?php
function mymenubuilder($arr) {
echo("<ul>");
foreach($arr as $key => $val) {
if (is_array($val)) {
echo("[*]".$key);
mymenubuilder($val);
echo("");
}
else {
echo("[*]".$val."\n");
}
}
echo("[/list]");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Menubuilder</title>
</head>
<body>
<?php
$menucontents = array("Home", "Products" => array("Gardening", "House Care", "Pet Care" => array("Dogs", "Kitties", "Birds")), "Vacations", "Contact Us");
mymenubuilder($menucontents);
?>
</body>
</html>
Poi c'è appunto da sapere come tratti/recuperi gli array come polinet già chiedeva.