I want to calculate total minute with my data.
[{"id":3,"zone_id":21,"created_at":"2017-06-22 09:49:33","updated_at":"2017-06-22 09:49:33","deviceNo":"ogrv", "type": "0" },{"id":4,"zone_id":22,"created_at":"2017-06-22 09:50:09","updated_at":"2017-06-22 09:50:09","deviceNo":"ogrv", "type": "1"},{"id":5,"zone_id":21,"created_at":"2017-06-22 09:50:35","updated_at":"2017-06-22 09:50:35","deviceNo":"ogrv", "type": "0"},{"id":6,"zone_id":22,"created_at":"2017-06-22 11:51:52","updated_at":"2017-06-22 11:51:52","deviceNo":"ogrv", "type": "1"},{"id":7,"zone_id":21,"created_at":"2017-06-22 11:54:57","updated_at":"2017-06-22 11:54:57","deviceNo":"ogrv", "type": "0"},{"id":8,"zone_id":22,"created_at":"2017-06-22 11:57:17","updated_at":"2017-06-22 11:57:17","deviceNo":"ogrv", "type": "1"}]
if type 0 will come I will start to calculate until type 1. How can I calculate it with php?
Each type means different actions so when different actions came I need the calculate minutes between this 2 data.
For example First Data came with type 0 that means user is inside then second data is came with type 1 and that means user is not inside. I need the calculate total minutes between this datas.
0 -> 1or1->0Am I right ? - Sagar Gautam