php: possible to convert array of numbers to 'from' and 'to' pairs where consecutive?
Posted
by Haroldo
on Stack Overflow
See other posts from Stack Overflow
or by Haroldo
Published on 2010-04-19T15:24:24Z
Indexed on
2010/04/19
16:03 UTC
Read the original article
Hit count: 115
php
- I have an array of timestamps referring to the days when a holiday home is booked.
- each timestamp is a round day.
- I want to turn this into an array of 'begins' and 'ends' pairs for consecutive dates
Are there any php functions I should be aware of for writing this function?
Or does anyone have any pointers for this kind of thing?
thanks!
edit:
example array:
Array
(
[0] => 1273536000
[1] => 1273622400
[2] => 1273708800
[3] => 1273795200
[4] => 1273881600
[5] => 1273968000
[6] => 1274054400
[7] => 1274140800
[8] => 1274227200
)
where a day = 86400 (seconds)
© Stack Overflow or respective owner