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;

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.70.0080.00818.68
8.3.60.0170.00318.68
8.3.50.0130.00518.54
8.3.40.0040.01219.20
8.3.30.0120.00318.96
8.3.20.0050.00321.89
8.3.10.0070.00023.48
8.3.00.0000.00819.92
8.2.190.0140.00716.75
8.2.180.0070.01425.92
8.2.170.0070.00722.96
8.2.160.0080.01019.06
8.2.150.0050.00324.18
8.2.140.0060.00324.66
8.2.130.0080.00019.44
8.2.120.0080.00026.35
8.2.110.0100.00722.05
8.2.100.0070.01118.16
8.2.90.0040.00418.03
8.2.80.0050.00219.46
8.2.70.0080.00018.16
8.2.60.0030.00518.17
8.2.50.0040.00418.22
8.2.40.0000.00822.18
8.2.30.0050.00319.56
8.2.20.0050.00318.23
8.2.10.0000.00818.25
8.2.00.0000.00918.12
8.1.280.0070.01125.92
8.1.270.0080.00022.03
8.1.260.0060.00326.35
8.1.250.0000.00828.09
8.1.240.0060.00323.92
8.1.230.0060.00622.71
8.1.220.0040.00417.77
8.1.210.0000.00818.89
8.1.200.0060.00317.48
8.1.190.0060.00317.60
8.1.180.0000.00818.10
8.1.170.0060.00318.86
8.1.160.0070.00019.01
8.1.150.0040.00419.13
8.1.140.0000.00817.78
8.1.130.0040.00417.62
8.1.120.0000.00717.67
8.1.110.0050.00217.64
8.1.100.0000.00717.69
8.1.90.0040.00417.74
8.1.80.0080.00017.66
8.1.70.0030.00317.69
8.1.60.0040.00417.75
8.1.50.0000.00917.71
8.1.40.0050.00217.70
8.1.30.0150.00217.84
8.1.20.0160.00617.68
8.1.10.0140.00317.71
8.1.00.0110.00517.65
8.0.300.0090.00418.69
8.0.290.0030.00617.00
8.0.280.0050.00318.57
8.0.270.0030.00316.98
8.0.260.0030.00317.07
8.0.250.0040.00417.26
8.0.240.0040.00417.23
8.0.230.0040.00417.22
8.0.220.0100.00017.19
8.0.210.0040.00417.02
8.0.200.0000.00717.08
8.0.190.0000.00817.27
8.0.180.0070.00017.03
8.0.170.0030.00717.18
8.0.160.0060.00517.13
8.0.150.0110.00417.08
8.0.140.0060.00616.98
8.0.130.0080.00415.84
8.0.120.0110.00417.05
8.0.110.0110.00417.15
8.0.100.0110.00517.09
8.0.90.0100.00617.06
8.0.80.0130.00617.13
8.0.70.0120.00417.11
8.0.60.0090.00717.02
8.0.50.0120.00417.14
8.0.30.0100.01017.20
8.0.20.0110.00717.26
8.0.10.0120.00317.17
8.0.00.0080.00617.17
7.4.330.0080.00414.93
7.4.320.0030.00316.55
7.4.300.0030.00316.69
7.4.290.0030.00316.68
7.4.280.0070.00516.73
7.4.270.0040.00416.71
7.4.260.0120.00416.69
7.4.250.0150.00216.67
7.4.240.0090.00416.68
7.4.230.0100.00316.63
7.4.220.0050.00716.74
7.4.210.0090.00416.73
7.4.200.0030.00716.71
7.4.190.0070.00616.68
7.4.180.0110.00216.77
7.4.160.0080.00816.68
7.4.150.0110.00216.68
7.4.140.0120.00817.50
7.4.130.0130.00616.72
7.4.120.0120.00816.72
7.4.110.0150.00516.69
7.4.100.0090.00716.64
7.4.90.0070.00816.62
7.4.80.0120.00417.59
7.4.70.0100.00416.61
7.4.60.0080.00716.64
7.4.50.0160.00116.60
7.4.40.0140.00316.58
7.4.30.0110.00616.56
7.4.20.0110.00716.52
7.4.10.0100.00616.60
7.4.00.0110.00716.25
7.3.330.0130.00215.53
7.3.320.0120.00415.30
7.3.310.0110.00516.46
7.3.300.0120.00416.41
7.3.290.0110.00516.50
7.3.280.0100.00316.43
7.3.270.0150.00416.42
7.3.260.0120.00616.63
7.3.250.0190.00016.55
7.3.240.0100.00816.61
7.3.230.0110.00716.54
7.3.220.0090.00816.54
7.3.210.0130.00516.59
7.3.200.0120.00516.44
7.3.190.0100.00616.51
7.3.180.0150.00316.53
7.3.170.0130.00416.45
7.3.160.0140.00516.55
7.3.150.0110.00816.35
7.3.140.0100.00716.45
7.3.130.0150.00516.52
7.3.120.0140.00516.51
7.3.110.0100.00816.11
7.3.100.0120.00416.13
7.3.90.0120.00416.24
7.3.80.0100.00716.14
7.3.70.0100.00515.88
7.3.60.0130.00615.85
7.3.50.0090.00815.80
7.3.40.0100.00615.74
7.3.30.0100.00815.87
7.3.20.0100.00716.48
7.3.10.0130.00616.36
7.3.00.0090.01016.37
7.2.340.0170.00216.68
7.2.330.0130.00716.88
7.2.320.0160.00516.86
7.2.310.0140.00616.73
7.2.300.0130.00816.67
7.2.290.0120.00916.74
7.2.280.0130.00716.58
7.2.270.0150.00516.76
7.2.260.0130.00616.78
7.2.250.0130.00616.66
7.2.240.0130.00616.36
7.2.230.0120.00416.38
7.2.220.0100.00616.38
7.2.210.0130.00416.33
7.2.200.0130.00516.21
7.2.190.0100.00715.87
7.2.180.0090.00915.99
7.2.170.0120.00416.02
7.2.160.0110.00616.04
7.2.150.0140.00516.63
7.2.140.0120.00616.70
7.2.130.0120.00716.81
7.2.120.0140.00416.70
7.2.110.0140.00416.71
7.2.100.0150.00316.68
7.2.90.0210.00716.74
7.2.80.0110.00716.68
7.2.70.0130.00616.68
7.2.60.0120.00816.72
7.2.50.0110.00816.74
7.2.40.0160.00916.95
7.2.30.0200.00316.99
7.2.20.0150.00916.87
7.2.10.0150.00816.88
7.2.00.0120.00916.97
7.1.330.0170.00616.22
7.1.320.0140.00316.24
7.1.310.0110.00816.17
7.1.300.0100.00715.46
7.1.290.0100.00815.55
7.1.280.0110.00815.49
7.1.270.0110.00715.47
7.1.260.0110.00815.49
7.1.250.0090.00915.38
7.1.240.0140.00715.36
7.1.230.0140.00715.40
7.1.220.0240.00615.40
7.1.210.0130.00815.50
7.1.200.0140.00715.51
7.1.190.0160.00815.44
7.1.180.0140.00615.32
7.1.170.0130.00715.43
7.1.160.0150.00915.66
7.1.150.0190.00615.72
7.1.140.0190.00715.73
7.1.130.0180.00715.65
7.1.120.0160.00815.70
7.1.110.0210.00815.71
7.1.100.0190.00715.67
7.1.90.0210.00515.73
7.1.80.0250.00515.62
7.1.70.0200.00815.50
7.1.60.0220.01118.09
7.1.50.0230.00818.01
7.1.40.0210.00818.02
7.1.30.0250.00817.95
7.1.20.0360.00718.06
7.1.10.0230.00715.45
7.1.00.0220.00715.41
7.0.330.0140.00615.10
7.0.320.0070.01316.46
7.0.310.0120.00916.40
7.0.300.0100.01016.51
7.0.290.0140.00616.60
7.0.280.0100.01016.43
7.0.270.0150.00416.59
7.0.260.0140.00516.56
7.0.250.0140.00616.58
7.0.240.0120.00616.60
7.0.230.0130.00616.66
7.0.220.0120.00616.81
7.0.210.0120.00816.56
7.0.200.0130.00616.60
7.0.190.0210.00616.70
7.0.180.0140.00616.65
7.0.170.0160.00416.73
7.0.160.0150.00516.60
7.0.150.0150.00516.48
7.0.140.0150.00516.57
7.0.130.0140.00616.72
7.0.120.0120.00716.49
7.0.110.0160.00416.50
7.0.100.0150.00516.66
7.0.90.0120.00616.50
7.0.80.0140.00616.47
7.0.70.0130.00316.48
7.0.60.0140.00716.43
7.0.50.0110.00516.48
7.0.40.0140.00416.50
7.0.30.0240.00316.55
7.0.20.0110.00616.53
7.0.10.0170.00216.47
7.0.00.0080.00916.38
5.6.400.0100.00915.18
5.6.390.0130.00915.17
5.6.380.0120.00715.30
5.6.370.0160.00615.97
5.6.360.0140.00616.14
5.6.350.0150.00516.09
5.6.340.0120.00716.12
5.6.330.0130.00616.09
5.6.320.0150.00416.10
5.6.310.0100.00916.14
5.6.300.0160.00515.98
5.6.290.0160.00416.03
5.6.280.0120.00616.11
5.6.270.0150.00516.10
5.6.260.0130.00616.02
5.6.250.0130.00716.09
5.6.240.0160.00316.11
5.6.230.0130.00716.13
5.6.220.0110.00816.13
5.6.210.0120.00515.94
5.6.200.0140.00616.01
5.6.190.0150.00416.16
5.6.180.0120.00616.07
5.6.170.0150.00516.16
5.6.160.0110.00716.17
5.6.150.0110.00816.16
5.6.140.0110.00616.17
5.6.130.0100.00716.20
5.6.120.0130.00616.16
5.6.110.0130.00516.01
5.6.100.0130.00516.11
5.6.90.0130.00616.00
5.6.80.0100.00816.00
5.6.70.0110.00716.12
5.6.60.0120.00616.06
5.6.50.0140.00315.97
5.6.40.0130.00516.05
5.6.30.0120.00716.02
5.6.20.0120.00616.03
5.6.10.0150.00316.06
5.6.00.0140.00815.94

preferences:
21.84 ms | 401 KiB | 5 Q