Skip to content

Instantly share code, notes, and snippets.

@edwardteach42
Created February 1, 2012 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edwardteach42/1719597 to your computer and use it in GitHub Desktop.
Save edwardteach42/1719597 to your computer and use it in GitHub Desktop.
Store Array to Database field as CSV
<?php
$array = array('value1', 'value2', 'value3');
$comma_separated = implode(",", $array);
print $comma_separated; // value1,value2,value3
//when you pull it back out, explode it, and then you will have your array!
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment