Skip to content

Instantly share code, notes, and snippets.

@abdullahbutt
Created October 6, 2017 10:01
Show Gist options
  • Select an option

  • Save abdullahbutt/ed0259d030b3fa9b472b884ce6ed6cff to your computer and use it in GitHub Desktop.

Select an option

Save abdullahbutt/ed0259d030b3fa9b472b884ce6ed6cff to your computer and use it in GitHub Desktop.
php years range
<?php
$years = range(date("Y"),date("Y")+15);
var_dump($years);
/*
// If current year is 2017, Result will be below:
array(16) {
[0]=>
int(2017)
[1]=>
int(2018)
[2]=>
int(2019)
[3]=>
int(2020)
[4]=>
int(2021)
[5]=>
int(2022)
[6]=>
int(2023)
[7]=>
int(2024)
[8]=>
int(2025)
[9]=>
int(2026)
[10]=>
int(2027)
[11]=>
int(2028)
[12]=>
int(2029)
[13]=>
int(2030)
[14]=>
int(2031)
[15]=>
int(2032)
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment