protected function fputcsv($filePointer, $dataArray, $delimiter = ",",   $enclosure = "\"")
  {
    // Build the string
    $string = "";
    // No leading delimiter
    $writeDelimiter = false;
    foreach ($dataArray as $dataElement) {
      // Replaces a double quote with two double quotes
      $dataElement = str_replace("\"", "\"\"", $dataElement);
      // Adds a delimiter before each field (except the first)
      if ($writeDelimiter) {
        $string .= $delimiter;
      }
      // Encloses each field with $enclosure and adds it to the string
      if ($enclosure) {
        $string .= $enclosure . $dataElement . $enclosure;
      } else {
        $string .= $dataElement;
      }
      // Delimiters are used every time except the first.
      $writeDelimiter = true;
    }
    // Append new line
    $string .= "\n";
    // Write the string to the file
    fwrite($filePointer, $string);
  }