I was wondering if someone could help me out.
I have a function that imports a CSV into an array, but i need to remove the first line with the
My CSV is formatted like so:
lat,lng,id
-34.837834,1387457,2
and so on, you get the ID
My function looks like this
private function getArrayFromCsv($file,$delimiter)
{
if (($handle = fopen($file, "r")) !== FALSE) {
$i = 0;
while (($lineArray = fgetcsv($handle, 4000, $delimiter)) !== FALSE) {
for ($j=0; $j<count($lineArray); $j++) {
$dataArray[$i][$j] = $lineArray[$j];
}
$i++;
}
fclose($handle);
}
return $dataArray;
}
The array that is outputted is as follows:
Array
(
[0] => Array
(
[0] => lat
[1] => lng
[2] => id
)
[1] => Array
(
[0] => -34.837834
[1] => 1387457
[2] => 2
and so on .....
How do i go about removing the array that shows the lat,lng,id and start from the next line in the CSV?
Cheers,