Skip to content
Advertisement

Php, fill hours missing in array [closed]

I have an array composed by starting hour and finish hour. Like:

JavaScript

What i need is to fill the missings hours:

JavaScript

Thanks

Advertisement

Answer

You need to iterate over the hours, and check that the las number of a loop is the same as the first number of the next loop, if not, add the interval:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement