使用关联数组在PHP中导航功能

Create an empty variable named output. Write a foreach loop for the nav_sections variable. With each iteration, append to the output variable a listitem (<li>) with a hyperlink contained within. The array key should be displayed as the clickable text ofthe hyperlink. The href attribute should contain a concatenation of URL_ROOT (constant) and the array item’s value. Example: <li><a href=”http://www.example.com/menu/”>Menu Echo the output variable (this will echo the output in the place where the function is called).

This is what I have so far - Is this correct? Help me out here.

function main_nav()
{
$nav_sections= array(
     "Home" => "",
     "Menu" => "menu",
     "Members Club" => "vip",
     "About Us" => "about",
     "Contact Us" => "contact"
);

$output = "";

foreach($nav_sections AS $key => $value)
{
$output = '<li> <a href="' . URL_ROOT . $value '">' . $key '</a> </li>';
}

echo $output; 
}

Maybe you forget to concatenate output ?

foreach($nav_sections AS $key => $value)
{
    $output .= '<li> <a href="' . URL_ROOT . $value '">' . $key '</a> </li>';
}