Ver original$str = ""; foreach($id as $valor) {$str .= "$valor, ";}$str = substr($str,0,-2); echo $str;