Does anyone know how I can make the following pre_replace also strips out whitespace BETWEEN the commas?
Right now it will trim the elements of any whitespace that may come before or after the comma. But, say, I have this:
It won't strip out the space between the 2 and the 4, or the 1 and the 1.
Code:
$str = trim(preg_replace('|\\s*(?:' . preg_quote($delimiter) . ')\\s*|', $delimiter, $str));