I am trying to export an array to csv, but my csv contains only one row with many fields (columns). I want to achieve to export into rows my data. My data looks like when I dump:
array(2) { [0]=> string(10) "something1" [1]=> string(18) "something2" }
here is the php code: ($names is my array)
$list = array ($names);
$fp = fopen('download.csv', 'w');
foreach ($list as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
Thank you in advance!