You can use the implode function:
$your_array = array('a', 'b', 'c', 'd'); $string = implode(',', $your_array); echo $string;
You will get this result:
a,b,c,d
Note that ' , ' were added between the elements of the array, not at the beginning and end of the line.
source share