How to reduce lists of ranges ?
Given a list of ranges ie: 1-3,5,6-4,31,9,19,10,25-20 how can i reduce it to 1-6,9-10,19-25,31 ? Here is what i've done so far, it seems a little bit complicated, so is there any simpler/clever method to do this. $in = '1-3,5,6-4,31,9,19,10,25-20'; // Explode the list in ranges $rs = explode(',', $in); $tmp = array(); // for each range...