3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = "2008-01-01"; $b = "2008-01-15"; $i = date("Y-m", strtotime($a)); while($i <= date("Y-m", strtotime($b))){ echo $i."\n"; if(substr($i, 4, 2) == "12") $i = (date("Y", strtotime($i."01")) + 1)."01"; else $i++; }
based on k424D
Output for 4.3.0 - 5.6.30, hhvm-3.10.1 - 3.22.0, 7.0.0 - 7.3.0rc4
2008-01