Ho un problema con la lettura di un file delimitato da tabulazioni.Come creare un array strutturato da un file Tabdelimited con PHP?
La struttura sul mio file è:
Field 1 Field 2 Field 3
Element11 Element12 Element13
Element21 Element22 Element23
Element31 Element32 Element33
Da questo file Voglio creare un array con questa struttura:
$csv = array(
array( 'Field 1' => 'Element11',
'Field 2' => 'Element12',
'Field 3' => 'Element13',
),
array( 'Field 1' => 'Element21',
'Field 2' => 'Element22',
'Field 3' => 'Element23',
),
array( 'Field 1' => 'Element31',
'Field 2' => 'Element32',
'Field 3' => 'Element33',
)
);
Come posso fare questo?
In realtà, il file non è [C] omma [S] eperated (CSV) :) – tim
CSV è diventato sinonimo di ... beh, "dati separati da qualcosa", e come un collega di lavoro nei giorni in cui era solito dire; "Caratteri separati dai caratteri" –
@ColHeather Ecco perché ho fornito '" \ t "' come terzo parametro a 'fgetcsv()' ... :-D – DaveRandom