function csvToArray($path)
{
try{
$csv = fopen($path, 'r');
$rows = [];
$header = [];
$index = 0;
while (($line = fgetcsv($csv)) !== FALSE) {
if ($index == 0) {
$header = $line;
$index = 1;
} else {
$row = [];
for ($i = 0; $i < count($header); $i++) {
$row[$header[$i]] = $line[$i];
}
array_push($rows, $row);
}
}
return $rows;
}catch (Exception $exception){
return false;
}
}