submitted by: Snippissimo
PHP: Create comma separated list from array
Use the implode() command to create a comma separated list from an array.
code snippet:
<?php
//create a comma separated list from an array
$array = array('green','purple','blue','yellow','amber','red');
$comma_separated = implode(",", $array);
echo $comma_separated;
?>
sample output:
green,purple,blue,yellow,amber,red



