Creating a comma separated list of taxonomy terms for a node

The following code snippet will provide a comma separated list of taxonomy terms for a given node.

Without links to the taxonomy pages

<?php
$term_list 
= array();
foreach (
$node->taxonomy as $item) {
  
$term_list[$item->tid] = $item->name;
}
print 
implode(', '$term_list);
?>

With links to the taxonomy pages

<?php
$term_list 
= array();
foreach (
$node->taxonomy as $item) {
  
$term_list[$item->tid] = l($item->name'taxonomy/term/'$item->tid);
}
print 
implode(', '$term_list);
?>

Only showing terms from one vocabulary (with a link to the taxonomy page)

<?php
$term_list 
= array();
foreach (
$node->taxonomy as $item) {
  if (
$item->vid == 2$term_list[$item->tid] = l($item->name'taxonomy/term/'$item->tid);
}
print 
implode(', '$term_list);
?>