Printing comma-separated data
<?php
$sales = array( array('Northeast',12.54),
array('All Regions',12.34) );
$fh = fopen('php://output','w');
foreach ($sales as $sales_line) {
if (fputcsv($fh, $sales_line) === false) {
die("Can't write CSV line");
}
}
fclose($fh);
?>
Related examples in the same category