I’m having the following problem and quite frankly no idea how to solve it:
Each array has a numeric value in key[0] and a time in key[1]. My goal is to map this output against a 24 hour period.
Sum all key[0] values where key[1] time is between 00:00 – 01:00, 01:00 – 02:00, etc.
If there are no values in a certain time period, “0” should be printed.
Here are the arrays that hold the values:
Array (
[4045862944400] => Array (
[0] => 192
[1] => 23:52
)
[403274909688162] => Array (
[0] => 186
[1] => 22:21
)
[402735273075459] => Array (
[0] => 311
[1] => 04:29
)
[252948031457462] => Array (
[0] => 385
[1] => 06:22
)
[400606749954978] => Array (
[0] => 287
[1] => 05:01
)
[286755318061725] => Array (
[0] => 358
[1] => 04:51
)
[399687880046865] => Array (
[0] => 257
[1] => 21:51
)
[398332190182434] => Array (
[0] => 240
[1] => 23:19
)
[397768486905471] => Array (
[0] => 311
[1] => 05:38
)
[396907650324888] => Array (
[0] => 293
[1] => 03:38
)
[394850557197264] => Array (
[0] => 496
[1] => 05:12
)
[394121230603530] => Array (
[0] => 475
[1] => 04:15
)
[69757766367627] => Array (
[0] => 488
[1] => 04:01
)
[391602517522068] => Array (
[0] => 506
[1] => 03:44
)
[390848830930770] => Array (
[0] => 437
[1] => 06:05
)
[389975351018118] => Array (
[0] => 452
[1] => 04:00
)
[242486689170043] => Array (
[0] => 525
[1] => 04:13
)
[388151047867215] => Array (
[0] => 415
[1] => 00:22
)
[387476447934675] => Array (
[0] => 502
[1] => 04:51
)
[386620518020268] => Array (
[0] => 467
[1] => 06:05
)
[215937481836499] => Array (
[0] => 359
[1] => 01:10
) )
The output should be an array that represents 24 hours and has the according sum of values for each hour.
Here’s an idea to get you going: