3v4l.org

run code in 300+ PHP versions simultaneously
<?php $timestamp = strtotime('2019-01-18'); $date = date('Y-m-d', $timestamp); $mthDays = date('t', $timestamp); $dexpl = explode('-', $date); $y = 0; while ($y <= $mthDays) { echo date('Y-m-d',strtotime($dexpl[0]."-".$dexpl[1]."-".$y)) . \PHP_EOL; $y++; }
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
2018-12-31 2019-01-01 2019-01-02 2019-01-03 2019-01-04 2019-01-05 2019-01-06 2019-01-07 2019-01-08 2019-01-09 2019-01-10 2019-01-11 2019-01-12 2019-01-13 2019-01-14 2019-01-15 2019-01-16 2019-01-17 2019-01-18 2019-01-19 2019-01-20 2019-01-21 2019-01-22 2019-01-23 2019-01-24 2019-01-25 2019-01-26 2019-01-27 2019-01-28 2019-01-29 2019-01-30 2019-01-31

preferences:
134.07 ms | 408 KiB | 5 Q