title: Use PHP implode + array to return a comma separated list?
body: <p>I working on some WordPress code with the WP Alchemy class, and I'm trying to recall the meta values used in a page template as a comma separated list. However when WP Alchemy Meta Boxes store the values into the domain, they aren't saved with delimiters nor spaces, so it's much like: onetwothreefourfive...</p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>&lt;?php $meta = get_post_meta(get_the_ID(), $custom_metabox-&gt;get_the_id(), TRUE); ?&gt;
  &lt;li&gt;Via: &lt;?php foreach ($meta['g2m_via'] as $link) { ?&gt;&lt;a href="&lt;?php echo $link['g2m_via-link']; ?&gt;"&gt;
  &lt;?php
  $prefix = ', ';
  $words = array();
  $words[] = $link['g2m_via-title'];
  $words = array_map("unserialize", array_unique(array_map("serialize", $words)));
  for($i = 0; $i &lt; count($words); $i++){ $fruitlist = implode(', ', $words); print_r($fruitlist); } 
  ?&gt;&lt;/a&gt;&lt;?php } ?&gt;&lt;/li&gt;
  </code></pre>
  
  <p>$link['g2m_via-title'] is simply the name of the link that is stored in the meta field, i.e. Link1 would be the name, google,,com would be the link (which is not important here, I have that working). The other variables are all there. The $prefix variable does nothing, it was meant to act as a separator, like: $val .= $prefix . '' $link['g2m_via-title']; . ''; however, it causes: Link1, Link 1,Link 2, Link 1, Link 2, Link 3.</p>
  
  <p>So far with that code, I've gotten the closest to what I want:</p>
  
  <pre><code>Link1Link2Link3
  </code></pre>
  
  <p>But it needs to be: <code>Link1, Link2, Link3</code>, and so on without the comma on the last link title.</p>
  
  <p>Output of var_dump($link):</p>
  
  <pre><code>array(2) { 
      ["g2m_via-title"]=&gt; string(7) "JoyStiq" 
      ["g2m_via-link"]=&gt; string(22) "joystiq.com"; 
  }JoyStiq 
  array(2) { 
      ["g2m_via-title"]=&gt; string(9) "GrindGadget" 
      ["g2m_via-link"]=&gt; string(16) "grindgadget.com"; 
  } GrindGadget 
  array(2) { 
      ["g2m_via-title"]=&gt; string(13) "Engadget" 
      ["g2m_via-link"]=&gt; string(13) "engadget.com"; 
  } Engadget
  </code></pre>
  
  <p>What I WANT it to look like so ["g2m_via-title"] will stop duplicating:</p>
  
  <pre><code>array[1] { 
      ["g2m_via-title"]=&gt; "JoyStiq" 
      ["g2m_via-link"]=&gt; "joystiq.com"; 
  }
  array[2] { 
      ["g2m_via-title"]=&gt; "GrindGadget" 
      ["g2m_via-link"]=&gt; "grindgadget.com"; 
  }
  array[3] { 
      ["g2m_via-title"]=&gt; "Engadget" 
      ["g2m_via-link"]=&gt; "engadget.com"; 
  }
  </code></pre>
  
  <p>3 of the countless other pieces of code that I've tried: <a href="http://pastebin.com/wa0R8sDw" rel="nofollow">http://pastebin.com/wa0R8sDw</a>. </p>