PHP's implode
function can be used to convert an array into a string --- it is similar to join
in other languages.
You can use it like so:
$string_product = implode(',', $array);
With an array like [1, 2, 3]
, this would result in a string like "1,2,3"
.