I'm trying to write a csv file from an array, as a header of a csv file
$csv_fields[] = 'produto_quest';
$csv_fields[] = 'produto_quest1';
$csv_fields[] = 'comentario_aspecto_atm';
$csv_fields[] = 'aspecto_geral_int';
$csv_fields[] = 'organizacao_espaco';
$f = fopen('php://memory', 'w+');
fputcsv($f, $csv_fields, ";");
foreach ($relat as $fields) { // load from MySQL as a multidimensional array
foreach($fields as $key => &$value1) {
$value1 = iconv("UTF-8", "", $value1);
}
fputcsv($f, $fields, ";");
}
fseek($f, 0);
fpassthru($f);
fclose($f);
All the file is correct except a hidden character at the beginning of the file. If I open the file with notepad it display correctly, but in Excel there is a blank line at the beginning. Can anyone help me?