how to separate array with commas? [closed]

This is an inbuilt PHP function:

$result = implode($input, ',');

(as noted by Brian’s comment.