3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = "01-01-2007"; $b = "2008-02-15"; $i = date("Ym", strtotime($a)); while($i <= date("Ym", strtotime($b))){ echo $i."\n"; if(substr($i, 4, 2) == "12") $i = (date("Y", strtotime($i."01")) + 1)."01"; else $i++; }
based on BZOmb
Output for 5.1.3 - 7.2.0
200701 200702 200703 200704 200705 200706 200707 200708 200709 200710 200711 200712 200801 200802
Output for 5.1.0 - 5.1.2
197001 197002 197003 197004 197005 197006 197007 197008 197009 197010 197011 197012 197101 197102 197103 197104 197105 197106 197107 197108 197109 197110 197111 197112 197201 197202 197203 197204 197205 197206 197207 197208 197209 197210 197211 197212 197301 197302 197303 197304 197305 197306 197307 197308 197309 197310 197311 197312 197401 197402 197403 197404 197405 197406 197407 197408 197409 197410 197411 197412 197501 197502 197503 197504 197505 197506 197507 197508 197509 197510 197511 197512 197601 197602 197603 197604 197605 197606 197607 197608 197609 197610 197611 197612 197701 197702 197703 197704 197705 197706 197707 197708 197709 197710 197711 197712 197801 197802 197803 197804 197805 197806 197807 197808 197809 197810 197811 197812 197901 197902 197903 197904 197905 197906 197907 197908 197909 197910 197911 197912 198001 198002 198003 198004 198005 198006 198007 198008 198009 198010 198011 198012 198101 198102 198103 198104 198105 198106 198107 198108 198109 198110 198111 198112 198201 198202 198203 198204 198205 198206 198207 198208 198209 198210 198211 198212 198301 198302 198303 198304 198305 198306 198307 198308 198309 198310 198311 198312 198401 198402 198403 198404 198405 198406 198407 198408 198409 198410 198411 198412 198501 198502 198503 198504 198505 198506 198507 198508 198509 198510 198511 198512 198601 198602 198603 198604 198605 198606 198607 198608 198609 198610 198611 198612 198701 198702 198703 198704 198705 198706 198707 198708 198709 198710 198711 198712 198801 198802 198803 198804 198805 198806 198807 198808 198809 198810 198811 198812 198901 198902 198903 198904 198905 198906 198907 198908 198909 198910 198911 198912 199001 199002 199003 199004 199005 199006 199007 199008 199009 199010 199011 199012 199101 199102 199103 199104 199105 199106 199107 199108 199109 199110 199111 199112 199201 199202 199203 199204 199205 199206 199207 199208 199209 199210 199211 199212 199301 199302 199303 199304 199305 199306 199307 199308 199309 199310 199311 199312 199401 199402 199403 199404 199405 199406 199407 199408 199409 199410 199411 199412 199501 199502 199503 199504 199505 199506 199507 199508 199509 199510 199511 199512 199601 199602 199603 199604 199605 199606 199607 199608 199609 199610 199611 199612 199701 199702 199703 199704 199705 199706 199707 199708 199709 199710 199711 199712 199801 199802 199803 199804 199805 199806 199807 199808 199809 199810 199811 199812 199901 199902 199903 199904 199905 199906 199907 199908 199909 199910 199911 199912 200001 200002 200003 200004 200005 200006 200007 200008 200009 200010 200011 200012 200101 200102 200103 200104 200105 200106 200107 200108 200109 200110 200111 200112 200201 200202 200203 200204 200205 200206 200207 200208 200209 200210 200211 200212 200301 200302 200303 200304 200305 200306 200307 200308 200309 200310 200311 200312 200401 200402 200403 200404 200405 200406 200407 200408 200409 200410 200411 200412 200501 200502 200503 200504 200505 200506 200507 200508 200509 200510 200511 200512 200601 200602 200603 200604 200605 200606 200607 200608 200609 200610 200611 200612 200701 200702 200703 200704 200705 200706 200707 200708 200709 200710 200711 200712 200801 200802
Output for 4.3.0 - 5.0.5
200606 200607 200608 200609 200610 200611 200612 200701 200702 200703 200704 200705 200706 200707 200708 200709 200710 200711 200712 200801 200802