Continuing on my previous question.
I have text log file called reject. You can see it here
As you can see there are 4 steps on tab called:
1. Battery level
2. Piezo sound level
3. Left D3 (Ch 3) light intensity
4. Right D2 (Ch 1) light intensity
Now I want to count every row with condition:
Which column(Steps) value is filled then count it.
Example: on row 1, We can see the value 0 (any value) is on step Piezo sound level. Then count it.
So finally I can know how many quantity Reject Process.
Battery level = x quantity
Piezo sound level = x quantity
Left D3 (Ch 3) light intensity = x quantity
Right D2 (Ch 1) light intensity = x quantity
The PHP Code:
$fromDateTime = new DateTime('Wed, Sep 19 2018 08:00:00');
$toDateTime = new DateTime('Wed, Sep 19 2018 19:59:00');
$file = file_get_contents('reject.txt');
$lines = explode("\n",$file);
// counter
$rowsintimespan = 0;
// Do Line-By-Line starting by Line 16 (Array Index 15)
for($i = 15; $i < count($lines); $i++) {
// if the file is "Tue, Sep 18<tab>2018<tab>23:59:53<tab>"
$dateobj = DateTime::createFromFormat("???,?M?d??Y?H:i:s+", $lines[$i]);
// check if date is in your Timespan
if($dateobj < $toDateTime && $dateobj > $fromDateTime) {
$rowsintimespan++; // count if in timespan
}
}
// Debug-Output
echo $rowsintimespan;
UPDATE
I need to read the last column value, Example: if the value of row is on column Left D3 then count it. If the value of row is on column Piezo then count it.

