Use fputcsv(), fixes #4320