foreach ($list as $line) { fputcsv($fp, split(',', $line)); }
fclose($fp); ?>
Notes
Note: If PHP is not properly recognizing the line endings when reading files either on or created by a Macintosh computer, enabling the auto_detect_line_endings run-time configuration option may help resolve the problem.