3v4l.org

run code in 300+ PHP versions simultaneously
<?php $nonNewDay = array( array( '2:00 am', '11:00 am' ), array( '2:00 am', '11:00 am' ), array( '2:00 am', '11:00 am' ), array( '2:00 am', '11:00 am' ), array( '2:00 am', '11:00 pm' ), // Weekends array( '2:00 am', '4:00 pm' ), array( '2:00 am', '1:00 pm' ), ); $current_date = strtotime(date("g:00 a")); $value = $nonNewDay[date('N')-1]; // for php < 5.1, I think this one will do the work: // $value = $nonNewDay[(date('w') == 0 ? 6 : date('N')-1)]; if ((strtotime($value[0]) <= $current_date) && ($current_date < strtotime($value[1]))) { echo 'Blocked'; } ?>

preferences:
43.26 ms | 402 KiB | 5 Q