$file = fopen("contacts.csv","w");
foreach(array_unique($matches[0]) as $email) {
fputcsv($file,explode(',',$email));
}
fclose($file);
The above code generates a CSV file. How can I update the CSV from the last recorded line without overwriting from the beginning?