3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = "2014-12-01"; $b = "2015-02-01"; $i = date("Y-m", strtotime($a)); while($i <= date("Y-m", strtotime($b))){ echo $i."\n"; if(substr($i, 5, 2) == "12") $i = (date("Y", strtotime($i."01")) + 1)."01"; else $i++; }
based on 0kR8N
Output for 4.3.0 - 4.4.9, 5.2.0 - 7.2.0
2014-12 197101
Output for 5.0.0 - 5.1.6
2014-12