<?php


$str='first , second ,, third, ,fourth   suffix';
echo preg_replace('~\s*(?:(,)\s*)+|(\s)+~', '$1$2', $str) . PHP_EOL;
echo preg_replace('~\s*(?:([,\s])\s*)+~', '$1', $str);