Given an array of integers, what is the simplest way to iterate over it and figure out all the ranges it covers? for example, for an array such as:
$numbers = ar
startRange = array[0]; for(i=0;i 1) { endRange = array[i]; pushRangeOntoArray(startRange,endRange); i++; startRange = array[i] // need to check for end of array here } }