fputcsv

It format line as CSV and write to file pointer

Example

<?php

$data = array ( array(‘php’, ‘asp’, ‘jsp’, ‘js’));

$fp = fopen(‘test.csv’, ‘w’);

foreach ($data as $value) {

fputcsv($fp, $value);

}

fclose($fp);

?>

Share