3v4l.org

run code in 300+ PHP versions simultaneously
<?php $now = date("Y-m-d"); $from = new DateTime( $now ); echo $from; $from->modify('first day of this month'); $from = $from->format("Y-m-d"); $to = new DateTime( $now ); $to->modify('first day of next month'); $from = $to->format("Y-m-d"); echo $from; echo $to;

preferences:
45.01 ms | 402 KiB | 5 Q