3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php for ($i=0; $i<=12; $i++) { echo '<option value="'.date('Y-m-d', strtotime("-$i month")).'">'.date('Y-m', strtotime("-$i month")).'</option>'; }
based on Qt1hW
Output for 7.2.0
<option value="2017-11-03">2017-11</option><option value="2017-10-03">2017-10</option><option value="2017-09-03">2017-09</option><option value="2017-08-03">2017-08</option><option value="2017-07-03">2017-07</option><option value="2017-06-03">2017-06</option><option value="2017-05-03">2017-05</option><option value="2017-04-03">2017-04</option><option value="2017-03-03">2017-03</option><option value="2017-02-03">2017-02</option><option value="2017-01-03">2017-01</option><option value="2016-12-03">2016-12</option><option value="2016-11-03">2016-11</option>
Output for 4.3.0 - 7.1.10
<option value="2014-08-30">2014-08</option><option value="2014-07-30">2014-07</option><option value="2014-06-30">2014-06</option><option value="2014-05-30">2014-05</option><option value="2014-04-30">2014-04</option><option value="2014-03-30">2014-03</option><option value="2014-03-02">2014-03</option><option value="2014-01-30">2014-01</option><option value="2013-12-30">2013-12</option><option value="2013-11-30">2013-11</option><option value="2013-10-30">2013-10</option><option value="2013-09-30">2013-09</option><option value="2013-08-30">2013-08</option>