<?php $dt = new DateTime('2019-01-31'); $day = $dt->format('d'); for ($i=0; $i < 10; $i++) { $dt->modify('first day of this month')->add(new DateInterval('P1M')); if ($dt->format('t') < $day) { continue; } $final = $dt->format('Y-m-' . $day); echo $final."\n"; }
You have javascript disabled. You will not be able to edit any code.