In a file, I am wondering how to check if 0th element of each array is equal to one another.
For example I have CSV, while looping through it I need to compare that all the date-time for each data is measured in the same hour.
So PHP
while (($row = fgetcsv($file, 1000, ",")) !== FALSE ){
if($headerLine){
$headerLine = false;
} else {
print "<pre>";
print_r($row);
print "</pre>";
echo "<hr>";
echo $row[0];
}
}
Output would be:
Array
(
[0] => 2017-06-08 05:00:00
[1] => 2234
[2] => name1
[3] => 0
[4] => 32
[5] => 242
[6] => 324
2017-06-08 05:00:00
Array
(
[0] => 2017-06-08 05:00:00
[1] => 322
[2] => name2
[3] => 1
[4] => 34
[5] => 234
[6] => 432
)
2017-06-08 05:00:00
...
So I need to check whether each 0 row is equal to one another.