3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $yearRange = array(); // $years1 = range(date('Y'), (date('Y') - 5)); if (date('m')> 10 ) { $years1 = range(date('Y') + 1, (date('Y') - 2)); } else { $years1 = range(date('Y'), (date('Y') - 3)); } foreach ($years1 as $value) { $yearRange[$value] = $value; } print_r($yearRange);
Output for 4.3.0 - 7.2.0
Array ( [2015] => 2015 [2014] => 2014 [2013] => 2013 [2012] => 2012 )