3v4l.org

run code in 300+ PHP versions simultaneously
<?php $month = 5; $monthName = date('M', strtotime('2012-'.$month.'-01')); $from = strtotime('first day of '.$monthName); if ( $from < time() ) { $from = strtotime('first day of '.$monthName.' '.(date('Y')+1)); } $to = strtotime('last day of this month, 23:59:59', $from); echo date('d.m.Y H:i:s', $from)."\r\n"; echo date('d.m.Y H:i:s', $to)."\r\n";

preferences:
37.29 ms | 402 KiB | 5 Q