How do I separate multiple values for "print render($content['field']);" with a comma? So in my node template, I am using the following code:

print render($content['field_taxonomy']);


Sometimes there is only one result printed, and sometimes there are multiple results printed. How can I separate each result by a comma, but only if there are multiple results printed?

Thank you!
For example, I am fetching the texonomy vocabulary terms :

$terms = taxonomy_term_load_multiple(array(), array('vid' =&gt; '12')); 
foreach ($terms as $temsaccess) {
$name[]=$temsaccess-&gt;name;
}

&lt;a href="javascript:void(0);" id="&lt;?php echo $term_name; ?&gt;" Click="javascript:showProduct('&lt;?php echo $term_name; ?&gt;', this );"  data-filter="&lt;?php echo $temsaccess; ?&gt;"&gt;
&lt;?php echo $temsaccess; ?&gt;
&lt;/a&gt;


Or refer to this link.