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'));
Output for git.master, git.master_jit, rfc.property-hooks
Mon, 21 Jan 2019 00:00:00 +0100 is TRUE Tue, 22 Jan 2019 00:00:00 +0100 is FALSE Wed, 23 Jan 2019 00:00:00 +0100 is FALSE Thu, 24 Jan 2019 00:00:00 +0100 is TRUE Fri, 25 Jan 2019 00:00:00 +0100 is TRUE Sat, 19 Jan 2019 00:00:00 +0100 is TRUE Sun, 20 Jan 2019 00:00:00 +0100 is FALSE

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
182.35 ms | 406 KiB | 5 Q