If the function cannot open $filename, it'll return false.
<?php
function magic_csv($filename){
$f = @fopen($filename,'r');
if (!$f) return false;
$headers = fgetcsv($f,8090);
$all = array();
while (!feof($f)){
$values = fgetcsv($f,8098);
$row = array();
$i=0;
if (is_array($values)){
foreach($values as $v){
if ($i < count($headers)) $row[$headers[$i]] = $v;
$i++;
}
$all[] = $row;
}
}
return $all;
}
?>
loading

