extra space being added in array output
<p>I'm trying to create a custom function to take a array and add comma. Like for a location or list of items.</p>

<pre><code>function arraylist($params)
{
    $paramlist = reset($params);
    while($item = next($params))
    {
        $paramlist = $item . ', ' . $paramlist;
    }
    return $paramlist;
}

$location = array('San Francisco','California','United States');

echo arraylist($location);
</code></pre>

<p><code>San Francisco , California, United States</code> is the output. It should out put <code>San Francisco, California, United States</code></p>
