Forcing fputcsv to Use Enclosure For *all* Fields

No, fputcsv() only encloses the field under the following conditions /* enclose a field that contains a delimiter, an enclosure character, or a newline */ if (FPUTCSV_FLD_CHK(delimiter) || FPUTCSV_FLD_CHK(enclosure) || FPUTCSV_FLD_CHK(escape_char) || FPUTCSV_FLD_CHK(‘\n’) || FPUTCSV_FLD_CHK(‘\r’) || FPUTCSV_FLD_CHK(‘\t’) || FPUTCSV_FLD_CHK(‘ ‘) ) There is no “always enclose” option.

fputcsv and newline codes

// Writes an array to an open CSV file with a custom end of line. // // $fp: a seekable file pointer. Most file pointers are seekable, // but some are not. example: fopen(‘php://output’, ‘w’) is not seekable. // $eol: probably one of “\r\n”, “\n”, or for super old macs: “\r” function fputcsv_eol($fp, $array, $eol) … Read more