3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function getAvailableSubscriptionEndYears() { $currentYear = intval(date_create()->format('Y')); $availableYears = array($currentYear => $currentYear); for($i=1;$i<10;$i++) { $nextYear = $currentYear+1; $availableYears[$nextYear] = $nextYear; } return $availableYears; } var_dump(getAvailableSubscriptionEndYears()); ?>
Output for 5.3.18 - 5.4.45, 5.6.28, 7.0.20 - 7.2.0
array(2) { [2015]=> int(2015) [2016]=> int(2016) }
Output for 5.5.24 - 5.6.21, 7.0.0 - 7.0.6
array(2) { [2016]=> int(2016) [2017]=> int(2017) }