How To write one column array to csv file

I am trying to write post variables to a csv file but it writes everything in one line separated by comma

<?php

$list= array($_POST['purchases']);
$file = fopen("purchases.csv", "w");

foreach ($list as $line)
{
fputcsv($file, $line); 
}

fclose($file); 
?>

Result in purchases.csv file

Marilyn,Nancy,Johan,Carol,Juanic,Shirley

But I want every string value on separated line

Marilyn
Nancy
Johan
Carol
Juanic
Shirley

Add a carriage return and line feed to each entry is one way just add \r\n to each $line before adding it to the csv file.

Sponsor our Newsletter | Privacy Policy | Terms of Service