3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = new DateTime(); echo $date->format('Y-m-d') . "\n"; echo $date->modify('last day of this month')->format('Y-m-d') . "\n"; echo $date->modify('first day of this month')->format('Y-m-d') . "\n"; echo $date->modify('last day of this month')->format('Y-m-d') . "\n";
based on G5RHF
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.21, 7.4.0 - 7.4.10, 8.0.0alpha1 - beta3
2020-02-28 2020-02-29 2020-02-01 2020-02-29