I open a csv file from a url. Each line has 4 fields and each field has a name:
Field1;Field2;Field3;Field4
Now my script handles the csv data as one single line but I want to have it this way:
Array
(
[0] => array(
['field1'] => 1
['field2'] => 2
['field3'] => 3
['field4'] => 4
)
)
Any ideas?
Here is my code:
if (($handle = fopen ( $eurl, "r" )) !== FALSE) {
while ( ($data = fgetcsv ( $handle, 4096, ";" )) !== FALSE ) {
$num = count ( $data );
for($c = 0; $c < $num; $c ++) {
echo $data [$c];
}
}
fclose ( $handle );
}