1. array_filter()
simply remove null/empty values froma an array.
$entry = array(
0 => 'foo',
1 => false,
2 => -1,
3 => null,
4 => ''
);
print_r(array_filter($entry));
Array ( [0] => foo [2] => -1 )
2. readCSV
this function simply takes csv filename(with path) and return an array
function readCSV($csvFile) { $file_handle = fopen($csvFile, 'r'); while (!feof($file_handle)) { $line_of_text[] = fgetcsv($file_handle, 1024); } fclose($file_handle); return array_filter($line_of_text); }
No comments:
Post a Comment