Q:

arrays with navigation printing out the links

<?php
$links = array(

    "Design" => "http://someurlhere.com", 
    "Marketing" => "http://someurlhere.com",
    "Content" => "http://someurlhere.com", 
    "Art" => "http://someurlhere.com", 
    "Video" => "http://someurlhere.com", 
    "Innovation" => "http://someurlhere.com", 
    "Technology" => "http://someurlhere.com", 
    "Legal" => "http://someurlhere.com", 
    "Accounting" => "http://someurlhere.com", 
);

// recursive function to build navigation list
function buildNav($links)
{

   echo "<ul>";

   foreach ($links as $link) {
       echo "<li>$link</li>";
   }

   echo "</ul>";
}

buildNav($links);
?>

I get the urls printed and they aren't links and not the titles e.g. design prints as http://someurlhere.com, can anyone help please with printing the title e.g. Design as the link name and then link the urls when they are clicked.

A:

Just add your <a> like any other link. They key here is to use foreach ($array as $key => $value) syntax in your foreach loop:
foreach ($links as $link => $url) {
    echo "<li><a href='$url'>$link</a></li>";
}

