public function csvToArray($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;
}
$file = fopen('myCSVFile.csv', 'r');
while (($line = fgetcsv($file)) !== FALSE) {
//$line is an array of the csv elements
print_r($line);
}
fclose($file);
$lines =file('CSV Address.csv');
foreach($lines as $data)
{
list($name[],$address[],$status[])
= explode(',',$data);
}