What are common errors encountered when using fputcsv in PHP?

One common error when using fputcsv in PHP is encountering extra blank lines in the output file. This can happen when there are whitespace characters before or after the PHP opening and closing tags. To solve this issue, make sure there are no whitespace characters before or after the PHP tags in your script.

<?php
$file = fopen('output.csv', 'w');
$data = array(
    array('John', 'Doe', 30),
    array('Jane', 'Smith', 25)
);

foreach ($data as $row) {
    fputcsv($file, $row);
}

fclose($file);
?>