function csv_split ($line, $delim=',', $removeQuotes=true)
Convert CSV lines to an array. PHP already has a function to load a CSV file to an array, but not from a string to an array.
This function is made by php[at]dogpoop.cjb.net from php.net.
$line = the csv line to be split
$delim = the delimiter to split by
$removeQuotes = if this is false, the quotation marks won't be removed from the fields
$string = 'name,address,city,age,last position';
print_r (csv_split ($string));
// Array ('name','address','city','age','last position');
Subscribe to our newsletter for the latest updates and exciting promo!