3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lastmonday = strtotime('last monday of this month'); echo date('Y-m-d',$lastmonday); $firstday = strtotime('first day of this month'); echo date('Y-m-d',$firstday); $d1 = new DateTime($lastmonday); $d2 = new DateTime($firstday); $period_serv = $d1->diff($d2); $theperiod = $period_serv->format('%a'); echo $theperiod;

preferences:
49.29 ms | 402 KiB | 5 Q