Search the blog

To add a line to the end of a CSV file using PHP simply use this code:

$array = ['Each', 'item', 'is', 'a', 'column'];
$handle = fopen('file.csv', 'a');
fputcsv($handle, $array);
fclose($handle);
Tim Bennett is a web designer and developer. He has a First Class Honours degree in Computing from Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.