All pastes #23665 Raw Edit

Derek

public php v1 · immutable
#23665 ·published 2005-09-23 04:44 UTC
rendered paste body
function fputcsv($filePointer, $dataArray, $delimiter, $enclosure){     // Write a line to a file     // $filePointer = the file resource to write to     // $dataArray = the data to write out     // $delimeter = the field separator         // Build the string     $string = "";     $writeDelimiter = FALSE;     foreach($dataArray as $dataElement){       if($writeDelimiter) $string .= $delimiter;       $string .= $enclosure . $dataElement . $enclosure;       $writeDelimiter = TRUE;       } // end foreach($dataArray as $dataElement)         // Append new line     $string .= "\n";         // Write the string to the file     @fwrite($filePointer, $string);    }