Search This Blog

Loading...

Tuesday, November 8, 2011

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

0 comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails