i am sending a csv file as a header and i want to use a comma (not to seperate, just to use). how would i do that?
i\'m using PHP and i can not use fputcsv
beca
Just use '"'.$value.'"'
around it and it will be fine.
Either write the CSV to file first and then send it via readfile or write it to the output stream directly:
fputcsv(
fopen('php://output', 'w+'),
array(
'Some text',
'Some text with commas ,,,,,',
'Other text'
)
);
which will then print
"Some text","Some text with commas ,,,,,","Other text"
Note that fputcsv will also allow you to change delimiters and enclosures, so in addition to just wrapping the value in quotes you can also just change the delimiter to, for instance, a semicolon.
See the PHP Manual on supported wrappers in fopen: