Probably not very fast, but a simple method may be:
$str = "a,b,c,,,d";$str2 = "";while($str <> $str2) { $str2 = $str; $str = str_replace(',,', ',', $str);}
Probably not very fast, but a simple method may be:
$str = "a,b,c,,,d";$str2 = "";while($str <> $str2) { $str2 = $str; $str = str_replace(',,', ',', $str);}