Never mind I created a new solution that will start with the newest year.
Replace:
for ( $counter = intval($oldest); $counter <= intval($newest); $counter += 1)
With:
for ( $counter = intval($newest); $counter >= intval($oldest); $counter = $counter – 1)
Thank you for your work, it is greatly appreciated.