title: Wordpress: Removing the last comma for tag list
body: <p>I've created a custom foreach output that helps give me a tag id per post. I'm using commas to separate each tag. However, the last tag outputs a comma too, like this:</p>
  
  <p>kittens, dogs, parrots, (&lt;-- last comma)</p>
  
  <p>How should I go about revising the foreach output so that the last comma is removed so it displays like this:</p>
  
  <p>kittens, dogs, parrots</p>
  
  <p>Here's the code:</p>
  
  <pre><code>&lt;?php
  $posttags = get_the_tags();
  if ($posttags) {
      foreach($posttags as $tag) {
          echo '&lt;a href="';
          echo bloginfo(url);
          echo '/?tag=' . $tag-&gt;slug . '" class="tag-link-' . $tag-&gt;term_id . '"&gt;' . $tag-&gt;name . '&lt;/a&gt;, ';
      }
  }
  ?&gt;
  </code></pre>