Hello I have an array in PHP that looks like the following :
Array
(
[0] => 20140723,8,156.62,LTD.
20140418-23,16-4010061201,936-438-2501,Y,23,20140418,V849,10.00
20140418-29,16-4010091102,936-438-2501,Y,29,20140418,V849,2.00
0,16-4010091102,936-436-0524,works.com,Y,0,20140723,0,0
0,16-4010061201,936-438-2501,waterw.com,Y,0,20140723,0,0
0,16-4010091102,936-438-2501,waterworks.com,Y,0,20140723,0,0
[1] => 140723-1548.csv
)
What I would like to do is to create a csv file that has as content the first index of the array above and as title the second array index. I used the following function :
function createCSV($Myarray, $filename){
$fp = fopen($filename, "w");
fputcsv($fp, array($Myarray));
fclose($fp);
}
and I called it like that :
createCSV($Myarray[0], $Myarray[1]);//$Myarray is the array above
the problem I have is that the first cell in the csv output has all the data from the first index of the array, what I would like is to have each first index array line in a row in the csv.
Thanks