3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @param int $date Unix time * @return bool */ function isActive($date) { $days = [1 => 0b1000000, 0b0100000, 0b0010000, 0b0001000, 0b0000100, 0b0000010, 0b0000001, ]; $week = 0b1001110; $day = $days[date('N', $date)]; return ($week & $day) === $day; } function test($date) { printf("%s is %s\n", date('r', $date), isActive($date) ? 'TRUE' : 'FALSE'); } test(strtotime('monday')); test(strtotime('tuesday')); test(strtotime('wednesday')); test(strtotime('thursday')); test(strtotime('friday')); test(strtotime('saturday')); test(strtotime('sunday'));

preferences:
34.56 ms | 406 KiB | 5 Q