How can i get rid of trailing spaces in preg_split
result without using preg_replace
to first remove all spaces from $test
string?
$test = 'One , Two, Thee ';
$test = preg_replace('/\s+/', ' ', $test);
$pieces = preg_split("/[,]/", $test);