I have an array of numbers (zipcode-areas), like:
Array (
[0] => 34
[1] => 35
[2] => 36
[3] => 51
[4] => 53
[5] => 54
[6] => 55
[7] => 56
[8] => 57
[9] => 60
[10] => 61
[11] => 63
[12] => 64
[13] => 65
[14] => 66
[15] => 67
[16] => 68
[17] => 69
[18] => 74
[19] => 97
)
I want to sum the numbers in the array like that:
Array (
[0] => 34-36
[1] => 51
[2] => 53-57
[3] => 60-61
[4] => 63-69
[5] => 74
[6] => 97
)
How can I archieve that with PHP?