3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Keys are ISO-8601 numeric representation * of the days of the week */ $days = [ 1 => 0b0000001, // 1 2 => 0b0000010, // 2 3 => 0b0000100, // 4 4 => 0b0001000, // 8 5 => 0b0010000, // 16 6 => 0b0100000, // 32 7 => 0b1000000, // 64 ]; $mondayToFriday = 31; // 1 + 2 + 4 + 8 + 16 foreach ($days as $n => $v) { /** * Get the day's name using strftime (has locale capability) * strtotime("Sunday +n days") would work with ISO-8601 day * numbers or PHP's date("w") (0 - 6 / Sunday - Saturday) */ $day = strftime("%A", strtotime("Sunday +{$n} days")); echo "{$day}: " . (($v & $mondayToFriday) ? "Y" : "N") . PHP_EOL; } echo PHP_EOL; /** * The order of these is important */ $input["days"] = [ "Monday" => 0, "Tuesday" => 1, "Wednesday" => 0, "Thursday" => 0, "Friday" => 0, "Saturday" => 0, "Sunday" => 0, ]; $dec = bindec(strrev(implode("", $input["days"]))); echo "\$dec: {$dec}" . PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Function strftime() is deprecated in /in/R6u1v on line 28 Monday: Y Deprecated: Function strftime() is deprecated in /in/R6u1v on line 28 Tuesday: Y Deprecated: Function strftime() is deprecated in /in/R6u1v on line 28 Wednesday: Y Deprecated: Function strftime() is deprecated in /in/R6u1v on line 28 Thursday: Y Deprecated: Function strftime() is deprecated in /in/R6u1v on line 28 Friday: Y Deprecated: Function strftime() is deprecated in /in/R6u1v on line 28 Saturday: N Deprecated: Function strftime() is deprecated in /in/R6u1v on line 28 Sunday: N $dec: 2

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:
55.94 ms | 402 KiB | 8 Q