3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = "2009-01-01"; $b = "2016-02-15"; $i = date("Y", strtotime($a)); while($i <= date("Y", strtotime($b))){ echo $i."\n"; if(substr($i, 4, 2) == "12") $i = (date("Y", strtotime($i."01")) + 1); else $i++; }
based on v7DXL
Output for 5.6.0 - 7.3.0rc3
2009 2010 2011 2012 2013 2014 2015 2016