php fputcsv and enclosing fields

Roll your own function - its not hard:

 function dumbcsv($file_handle, $data_array, $enclosure, $field_sep, $record_sep)
 {
     dumbescape(false, $enclosure);
     $data_array=array_map('dumbescape',$data_array);
     return fputs($file_handle, 
         $enclosure 
         . implode($enclosure . $field_sep . $enclosure, $data_array)
         . $enclosure . $record_sep);
 }
 function dumbescape($in, $enclosure=false)
 {
    static $enc;
    if ($enclosure===false) {
        return str_replace($enc, '\\' . $enc, $in);
    }
    $enc=$enclosure;
 }

(above is using unix style escaping)

C.

Tags:

Php

Csv

Fputcsv