What is the standard method in PHP to append data to a .csv file?

To append data to a .csv file in PHP, you can use the fopen function with the 'a' flag to open the file in append mode. Then, you can use fputcsv to write the data as a CSV record to the file.

// Open the file in append mode
$file = fopen('data.csv', 'a');

// Data to append
$data = ['John Doe', 'john.doe@example.com', 'New York'];

// Write the data as a CSV record
fputcsv($file, $data);

// Close the file
fclose($file);