I have json response like this
Array
(
[0] => Array
(
[id] => 65070
[date] => 2015-06-05
[hour] => 0
[total] => 18
)
[1] => Array
(
[id] => 65070
[date] => 2015-06-05
[hour] => 2
[total] => 32
)
[2] => Array
(
[id] => 65070
[date] => 2015-06-07
[hour] => 0
[total] => 27
)
[3] => Array
(
[id] => 65070
[date] => 2015-06-07
[hour] => 2
[total] => 35
)
[4] => Array
(
[id] => 1838680
[date] => 2015-06-05
[hour] => 0
[total] => 957
)
[5] => Array
(
[id] => 1838680
[date] => 2015-06-05
[hour] => 2
[total] => 1266
)
[6] => Array
(
[id] => 1838680
[date] => 2015-06-07
[hour] => 0
[total] => 409
)
[7] => Array
(
[id] => 1838680
[date] => 2015-06-07
[hour] => 2
[total] => 1528
)
)
I want output like this
id Hour 2015-06-05 2015-06-07 Difference
65070 0 18 27 9
65070 2 32 35 3
1838680 0 957 409 -548
1838680 2 1266
Hour is not fixed to 0 or 2. It can be more than 2 or 1 also
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…