How can the issue of unwanted quotation marks being added to a text file during data export in PHP be prevented?

Unwanted quotation marks can be prevented in a text file during data export in PHP by properly formatting the data before writing it to the file. One way to do this is by using the `fputcsv` function in PHP, which automatically handles the formatting of data and ensures that quotation marks are only added when necessary.

// Sample data to be exported
$data = [
    ['John', 'Doe', 30],
    ['Jane', 'Smith', 25],
    ['Bob', 'Johnson', 35]
];

// Open a file for writing
$file = fopen('export.csv', 'w');

// Write data to the file using fputcsv
foreach ($data as $row) {
    fputcsv($file, $row);
}

// Close the file
fclose($file);