3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dateLastMonth = date("Y-m-d", strtotime("first day of last month")); $dateCurrentMonth = date("Y-m-d", strtotime("last day of last month")); var_dump($dateLastMonth, $dateCurrentMonth);
Output for 7.3.24 - 7.3.33, 7.4.12 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
string(10) "2017-06-01" string(10) "2017-06-30"

preferences:
109.61 ms | 402 KiB | 114 Q