My array looks like this;
Array
(
[0] => January
[1] => 2015-01-30
[2] => 2015-01-15
[3] => February
[4] => 2015-02-27
[5] => 2015-02-18
[6] => March
[7] => 2015-03-31
[8] => 2015-03-18
)
How can I output it to a csv in three columns? One for the Month name, and the other two for the two dates that follow.
At the moment my code looks like this;
$header = array("Month","Date One","Date Two");
$fp = fopen($filename, "w");
fputcsv ($fp, $header, "\t");
foreach($payments_array as $row){
fputcsv($fp, array($row), "\t");
}
fclose($fp);
The headers go in fine, but I don't know how to get three columns on the data. At the moment at array goes in to the csv all in one column.
I thought array_chuck()
might help - but I couldn't work it out.