my csv file link : https://drive.google.com/file/d/0B-Z58iD3By5wb2R2TnV0Rjc3Zzg/view
I already read many reference but I can not seperate my csv
by "," (the delimiter not working properly). Is there a solution how could I get an array like this from that csv
file:
`Array[0]=>
(
['username'] => Lexsa,
['date'] => 12/07/2017,
['retweet'] => null,
)`
`Array[1]=>
(
['username'] => any,
['date'] => 12/07/2017,
['retweet'] => null
)`
function csv_to_array($filename='', $delimiter=',')
{
if(!file_exists($filename) || !is_readable($filename))
return FALSE;
$header = NULL;
$data = array();
if (($handle = fopen($filename, 'r')) !== FALSE)
{
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
{
if(!$header)
$header = $row;
else
$data[] = array_combine($header, $row);
}
fclose($handle);
}
return $data;
}
I try to use many reference but the result is always like this the code wont split the line with ","
:
Array ( [0] => Array (["username","date","retweets","favorites","text","geo","mentions","hashtags","id","permalink"] => "Lexsa911","01/12/2016 0:05",0.0,0.0,"Kecelakaan - Kecelakaan Pesawat yang Melibatkan Klub-Klub Sepakbola http:// ht.ly/1IdL306EzDH",,,,"8,04E+17","https://twitter.com/Lexsa911/status/804008435020865536" )