function array2d_to_csv_download($data, $filename) {
header('Content-type: application/csv');
header('Content-Disposition: attachment; filename=' . $filename);
foreach($data as $row) {
function array2d_to_csv_download($data, $filename) {
header('Content-type: application/csv');
header('Content-Disposition: attachment; filename=' . $filename);
foreach($data as $row) {