I just want to add to deviousdodo the answer that if there is a case that there are empty strings in the array and you do not want them to appear in the concatenated string, for example, "a, b, d, f", then it is better to use the following:
$ str = implode (',', array_filter (array ('a', 'b', '', 'd', '', 'f')));
gnl
source share