$limit = 1;
$fileHandle = fopen($inputFileName, "r");
if ($fileHandle === FALSE) {
die('Error opening ' . $inputFileName);
}
// Set up a variable to hold our current position in the file
$offset = 0;
while (!feof($fileHandle)) {
// Go to where we were when we ended the last batch
fseek($fileHandle, $offset);
$i = 0;
while (($currRow = fgetcsv($fileHandle)) !== FALSE) {
$i++;
$row = implode('|', $currRow);
$list = explode('|', $row);
if (trim($list[0]) == 'System Setup') {
$fdt = $list[1];
$prvxdt = date('Y-m-d H:i:s', strtotime($fdt));
} elseif (trim($list[0]) == 'Probe Card Serial Number:') {
$prvxbc = substr(trim($list[1]), 0, 10);
}elseif (trim($list[0]) == 'Probe ID') {
$dia = substr(trim($list[23]), 0, 23);
}
if($i >= $limit)
{
//Update our current position in the file
$offset = ftell($fileHandle);
//Break out of the row processing loop
break;
}
}
}
// Close the file
fclose($fileHandle);
$fext = '.csv';
I want to get values from the csv file and Column name is called as Diamemter (um). I already get the column name by this line elseif (trim($list[0]) == 'Probe ID') { $dia = substr(trim($list[23]), 0, 23); }.
I want the total Maximum and Minimum values from Diameter (um) column. CSV column and values.
If I understand your question correctly, the column you mentioned (column X) is $list[23]
To get the min and max values, you may add the following before your while loop (inner while loop):
and then change
to
After the while loop (inner while loop), the $maxx and $minx will be the maximum value and minimum values respectively