I have below code
$file_path = 'file.csv';
if (($csv = fopen($file_path, 'r')) !== FALSE) {
$key_index = [];
$index = -1;
while (($row = fgetcsv($csv, 0, ',')) !== FALSE) {
$index++;
// Empty rows, mostly at bottom of file.
$is_empty = array_filter($row, 'strlen') == [];
if ($is_empty) {
continue;
}
if ($index == 0) {
$key_index = $row;
continue;
}
if ($index > 5) {
continue;
}
echo $index."<pre>";
print_r($row);
}
}
What I want to achieve is on basis of given min & max range it should return rows from CSV.
If min = 5 & max = 10 then it should return rows in between that only.
May be need to use fseek
or ftell
need to set file pointer again?