How to write data from an array in a CSV file?
Answer 1, Authority 100%
Use special fputcsv
& lt;? php
$ List = Array (
Array ('Aaa', 'BBB', 'CCC', 'DDDD'),
Array ('123', '456', '789'),
Array ('"AAA"', '"BBB"')
);
$ fp = fopen ('file.csv', 'w');
Foreach ($ List AS $ Fields) {
FPUTCSV ($ FP, $ Fields);
}
FClose ($ FP);
Answer 2
$ array = array ();
$ Hand = Fopen ("file.csv", "w");
For ($ i = 0; $ i & lt; = count ($ array); $ i ++)
{
FWRITE ($ Hand, $ Array [$ i]);
}
FClose ($ Hand);