3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time = strtotime(date('Y-m').'01'); echo date('Y-m-d',$time); echo '<br>'.$final = date("Y-m-d", strtotime("-1 month", $time));

preferences:
44.28 ms | 402 KiB | 5 Q