Remove comma on last item of foreach
<p>I have next code for WordPress loop of tags for single post:</p>

<pre><code>&lt;?php if ($tags) : foreach($tags as $tag): ?&gt;
&lt;a href="&lt;?php echo get_tag_link($tag); ?&gt;"&gt;
    &lt;?php echo $tag-&gt;name; ?&gt;
&lt;/a&gt;, 
&lt;?php endforeach; endif; ?&gt;
</code></pre>

<p>I have comma added to last anchor. There is also white space after comma.</p>

<p>How can I remove the comma from last anchor while I am doing this with foreach() PHP loop?</p>

<p>Thanks for ideas and help!</p>