Will the file holding the data always have the days in order, or could they appear randomly?If it's in order, then you could always check [x-1] to see if it's the same as the current [x] value (if it is, don't print the date).If not, you could sort the data first then do the above, or you could hold all the dates in a temporary array as you find them, and query that list every time [x] increases?