I'm doing function to export CSV file in PHP. but when i do an export, i need to add information about total in number_format().. but display is wrong.
Here is my code
header('Content-Type: text/csv; charset=utf-8');
header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
header('Content-Disposition: attachment; filename=' . $fileName );
header("Content-Transfer-Encoding: binary");
header('Pragma: no-cache');
header('Expires: 0');
$file = fopen("report.csv", "w");
fwrite($file, "Generate Report \r\n");
fwrite($file, "Total Sales, ".number_format($total)."\r\n");
fwrite($file, " "."\r\n");
the result is this
and that is wrong.
How do i can display the correct format number like "5,485" or maybe "5,485.00" in 1 cell on CSV file?
please help