如何格式化数组fputcsv结果是水平而不是垂直?

My $array looks like this in source code of my browser;

Array(
  [0] => 2015-01-15
  [1] => 2015-02-15
  [2] => 2015-03-15
)

My code to export this to a csv file is;

$fp = fopen("file.csv", "w");
fputcsv($fp, $array)
fclose($fp);

The output of the csv is horizontal. eg;

2015-01-01 | 2015-02-01 | 2015-03-01

I want it vertically;

2015-01-01
2015-02-01
2015-03-01

I don't know how to do this. I tried adding;

$fp = fopen("file.csv", "w", $delimiter = ',', $enclosure = '"');

And it didn't work. I tried creating a different array to test;

$array = array("2015-01-01", "2015-02-01", "2015-03-01");

And that gave the same horizontal result. I am open to changing the style/format of my array. Whatever gets the job done.

fputcsv() writes a line. For multiple lines you need to make multiple calls.

If each element in the array goes on a new line, just iterate the array:

   $fp = fopen("file.csv", "w");
    foreach($array as $element)
        fputcsv($fp, array($element));
    fclose($fp);

Note (as per comment by Rizier123) that you need to make $element an array.