Ver original$chunks = array_chunk(array_reverse(range(2010, 2016)),2); foreach($chunks as $chunk){ echo implode('-', $chunk) . "\n"; }