 <p>Assuming this data structure:</p> <pre><code>$links = array( array( "g2m_via-title" =&gt; "JoyStiq", "g2m_via-link" =&gt; "joystiq.com" ), array( "g2m_via-title" =&gt; "GrindGadget", "g2m_via-link" =&gt; "grindgadget.com" ), array( "g2m_via-title" =&gt; "Engadget", "g2m_via-link" =&gt; "engadget.com" ) ); </code></pre> <p>This'll do:</p> <pre><code>$output = array(); foreach ($links as $link) { $output[] = sprintf('&lt;a href="http://%s"&gt;%s&lt;/a&gt;', $link['g2m_via-link'], htmlentities($link['g2m_via-title'])); } echo join(', ', $output); </code></pre> <p>So will this in PHP 5.3+:</p> <pre><code>echo join(', ', array_map(function ($link) { return sprintf('&lt;a href="http://%s"&gt;%s&lt;/a&gt;', $link['g2m_via-link'], htmlentities($link['g2m_via-title'])); }, $links)); </code></pre>