PHP 5: Number Sequence
R.B. Klaassen (contact me)
This is a very simple class that can be used to format an array of numbers as a sequence of number ranges.
It takes an array of integer numbers and sorts the array.
The class generates a string that represents sequences of contiguous numbers as ranges with the first and the last sequence number separated by dashes. Non contiguous numbers are separated commas.
For instance, array(1,2,3,5,7,8,9) is transformed in the sequence "1-3, 5, 7-9".
Click here for detailed information about this class on phpclasses.org