Hey guys I'm geting a file CSV and when use print I have the output
$excelImoveis = $request->file('excel_imoveis');
$filePath = $excelImoveis->getRealPath();
$file = fopen($filePath, 'r');
$header = fgetcsv($file);
$array = [];
dd($header);
while (($columns = fgetcsv($file, 1000, ';')) !== FALSE) {
dd($header);
$array[] = array_combine(array_filter($header), array_filter($columns));
}
Outupu
array:1 [▼
0 => b"Código do Imóvel;FotoImovel;destaque;ordem"
]
How to remove "b" this item ? maybe this implied the error of array_conbine():
$array[] = array_combine(array_filter($header), array_filter($columns));
Error: array_combine(): Both parameters should have an equal number of elements