I focusing on some WordPress code using the Wordpress Alchemy class, and I am attempting to can remember the meta values utilized in a webpage template like a comma separated list. However, if Wordpress Alchemy Meta Boxes keep values in to the domain, they are not saved with delimiters nor spaces, therefore it is similar to: onetwothreefourfive...

This is what I've to date:

<?php $meta = get_post_meta(get_the_ID(), $custom_metabox->get_the_id(), TRUE); ?>
<li>Via: <?php foreach ($meta['g2m_via'] as $link) { ?><a href="<?php echo $link['g2m_via-link']; ?>">
$prefix = ', ';
$words = array();
$words[] = $link['g2m_via-title'];
$words = array_map("unserialize", array_unique(array_map("serialize", $words)));
for($i = 0; $i < count($words); $i++){ $fruitlist = implode(', ', $words); print_r($fruitlist); } 
?></a><?php } ?></li>

$link['g2m_via-title'] is just the title from the link that's saved within the meta area, i.e. Link1 will be the title, google,,com will be the link (which isn't important here, I've that working). Another variables are there. The $prefix variable does nothing, it had been designed to behave as a separator, like: $val .= $prefix . '' $link['g2m_via-title'] . '' however, it causes: Link1, Link 1,Link 2, Link 1, Link 2, Link 3.

To date with this code, I have become the nearest as to the I would like:


But it must be: Link1, Link2, Link3, and so forth with no comma around the last link title.

Creation of var_dump($link):

array(2) { 
    ["g2m_via-title"]=> string(7) "JoyStiq" 
    ["g2m_via-link"]=> string(22) "joystiq.com"; 
array(2) { 
    ["g2m_via-title"]=> string(9) "GrindGadget" 
    ["g2m_via-link"]=> string(16) "grindgadget.com"; 
} GrindGadget 
array(2) { 
    ["g2m_via-title"]=> string(13) "Engadget" 
    ["g2m_via-link"]=> string(13) "engadget.com"; 
} Engadget

Things I Would like it to seem like so ["g2m_via-title"] stop copying:

array[1] { 
    ["g2m_via-title"]=> "JoyStiq" 
    ["g2m_via-link"]=> "joystiq.com"; 
array[2] { 
    ["g2m_via-title"]=> "GrindGadget" 
    ["g2m_via-link"]=> "grindgadget.com"; 
array[3] { 
    ["g2m_via-title"]=> "Engadget" 
    ["g2m_via-link"]=> "engadget.com"; 

3 from the numerous other bits of code that I have attempted: http://pastebin.com/wa0R8sDw.

Presuming this data structure:

$links = array(
        "g2m_via-title" => "JoyStiq",
        "g2m_via-link"  => "joystiq.com"
        "g2m_via-title" => "GrindGadget",
        "g2m_via-link"  => "grindgadget.com"
        "g2m_via-title" => "Engadget",
        "g2m_via-link"  => "engadget.com"

This'll do:

$output = array();
foreach ($links as $link) {
    $output[] = sprintf('<a href="http://%s">%s</a>',

echo join(', ', $output);

Same goes with this in PHP 5.3+:

echo join(', ', array_map(function ($link) {
    return sprintf('<a href="http://%s">%s</a>',
}, $links));