- implode: documentation ( source)
<?php
$values = array(
'foo' => 10,
'bar' => 20,
'baz' => 30
);
$newarray = array();
foreach($values as $k => $v)
{
$newarray[$k] = $v;
if($k == 'bar')
$newarray['qux'] = 21;
}
echo implode(' ', $newarray);