["Boxname:HH, X1:53.3, X2:106.6, Y1:33.300000000000004,Y2:59.947215189873425, PID:22, GENDER:MALE, Age:63,Bp_Systolic:120,Bp_Diastolic:80", "Boxname:HH, X1:53.3, X2:106.6, Y1:33.300000000000004,Y2:59.947215189873425, PID:27, GENDER:FEMALE, Age:56,Bp_Systolic:110,Bp_Diastolic:70", "Boxname:HH, X1:53.3, X2:106.6, Y1:33.300000000000004,Y2:59.947215189873425, PID:33, GENDER:MALE, Age:58,Bp_Systolic:130,Bp_Diastolic:70", "Boxname:HH, X1:53.3, X2:106.6, Y1:33.300000000000004,Y2:59.947215189873425, PID:48, GENDER:FEMALE, Age:62,Bp_Systolic:132,Bp_Diastolic:80", "Boxname:HH, X1:53.3, X2:106.6, Y1:33.300000000000004,Y2:59.947215189873425, PID:50, GENDER:MALE, Age:60,Bp_Systolic:120,Bp_Diastolic:70", "Boxname:MH, X1:53.3, X2:106.6, Y1:33.300000000000004,Y2:59.947215189873425, PID:51, GENDER:MALE, Age:63,Bp_Systolic:118,Bp_Diastolic:62"]
I want to convert this array into csv export file. I have tried code like this.
<?php
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=data.csv');
// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');
// output the column headings
fputcsv($output, array('Column 1', 'Column 2', 'Column 3'));
$list=$name;
foreach ($list as $line)
{
fputcsv($output, $line);
}
?>
But i can t able to get the data. Can any body help me out. I have tried many ways. I think my array format giving trouble. Can anybody suggest array format from this to make the export easy.