Codice PHP:
$b '' ;

foreach(
$array as $value) {
  
$b .= $value",";
}

$b substr($b0, -1);  

echo 
$b