1) menu($row); is useless, because it does nothing
2) if you want to apply recursion, you must write like this:
function menu($arr, $parent) {
$open = 0;
foreach ($arr as $row) {
if ($parent == $row['parent_id']) {
echo ($open?'':'<ul>')."<li><a href={$row['link']}>{$row['title']}</a>";
menu($arr, $row['id']);
echo "</li>";
$open++;
}
}
if ($open) {
echo "</ul>";
}
}
menu($array, 0);