3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time_array = ["17:45", "13:12", "09:29", "17:32", "16:49", "14:18"]; $buckets = array_fill_keys([-1, 0, 1], 0); // initialize buckets with 0 values foreach ($time_array as $time) { ++$buckets[(int)sqrt(substr($time, 0, 2) - 8) <=> 2]; } echo "Morning Count: {$buckets[-1]}\n"; // Hours: 00:00 to 11:59 ->12hrs (calculates as: 0, 1) echo "Afternoon Count: {$buckets[0]}\n"; // Hours: 12:00 to 16:59 -> 5hrs (calculates as: 2) echo "Evening Count: {$buckets[1]}"; // Hours: 17:00 to 23:59 -> 7hrs (calculates as: 3, 4) echo "\n---\n"; foreach (range(0, 23) as $t) { $calc = (float)sqrt($t - 8); echo "$t: " , (int)$calc , " ... [float value from sqrt was: $calc]\n"; }

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.4.130.0130.00717.84
8.4.120.0130.00422.37
8.4.110.0120.00722.61
8.4.100.0070.00324.30
8.4.90.0080.00918.78
8.4.80.0060.01019.71
8.4.70.0060.00318.01
8.4.60.0070.00918.94
8.4.50.0120.01018.57
8.4.40.0060.00319.54
8.4.30.0090.00617.54
8.4.20.0140.00720.60
8.4.10.0130.00018.95
8.3.260.0090.00716.55
8.3.250.0090.01018.81
8.3.240.0100.00917.22
8.3.230.0130.00716.75
8.3.220.0110.00917.47
8.3.210.0120.00718.91
8.3.200.0050.00416.88
8.3.190.0100.00917.49
8.3.180.0140.00616.66
8.3.170.0090.00919.37
8.3.160.0040.01116.84
8.3.150.0110.00717.61
8.3.140.0140.00417.23
8.3.130.0060.00318.66
8.3.120.0100.00018.99
8.3.110.0090.00016.94
8.3.100.0090.00624.06
8.3.90.0100.01026.77
8.3.80.0060.00318.68
8.3.70.0070.00716.88
8.3.60.0090.01318.55
8.3.50.0070.00818.02
8.3.40.0160.00019.06
8.3.30.0070.00718.92
8.3.20.0030.00619.23
8.3.10.0030.00623.73
8.3.00.0050.00321.01
8.2.290.0110.00720.43
8.2.280.0140.00718.47
8.2.270.0100.01016.68
8.2.260.0150.00416.44
8.2.250.0040.00416.84
8.2.240.0030.00617.31
8.2.230.0120.00020.94
8.2.220.0030.00637.54
8.2.210.0050.00326.77
8.2.200.0090.00016.63
8.2.190.0120.00616.64
8.2.180.0070.00718.13
8.2.170.0070.01122.96
8.2.160.0070.00722.30
8.2.150.0000.00824.18
8.2.140.0030.00624.66
8.2.130.0080.00019.89
8.2.120.0030.00626.35
8.2.110.0060.00321.18
8.2.100.0060.00617.91
8.2.90.0050.00317.88
8.2.80.0090.00018.86
8.2.70.0030.00617.63
8.2.60.0080.00018.34
8.2.50.0040.00418.10
8.2.40.0040.00419.41
8.2.30.0080.00019.36
8.2.20.0070.00018.29
8.2.10.0040.00418.19
8.2.00.0060.00319.85
8.1.330.0110.00721.86
8.1.320.0140.00716.05
8.1.310.0100.00016.48
8.1.300.0040.00418.34
8.1.290.0060.00330.84
8.1.280.0100.00725.92
8.1.270.0040.00422.27
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.01222.02
8.1.230.0040.00720.97
8.1.220.0030.00618.69
8.1.210.0000.00818.77
8.1.200.0060.00617.38
8.1.190.0040.00417.48
8.1.180.0030.00518.10
8.1.170.0000.00818.71
8.1.160.0000.00718.90
8.1.150.0040.00418.97
8.1.140.0070.00022.20
8.1.130.0000.00717.59
8.1.120.0040.00417.45
8.1.110.0070.00017.50
8.1.100.0030.00517.58
8.1.90.0030.00517.40
8.1.80.0030.00617.41
8.1.70.0080.00017.49
8.1.60.0000.00817.56
8.1.50.0030.00517.46
8.1.40.0030.00517.50
8.1.30.0030.00617.63
8.1.20.0080.00017.64
8.1.10.0020.00517.55
8.1.00.0050.00317.46
8.0.300.0070.00020.02
8.0.290.0000.00916.75
8.0.280.0030.00318.56
8.0.270.0030.00316.82
8.0.260.0050.00216.94
8.0.250.0030.00316.98
8.0.240.0040.00417.04
8.0.230.0050.00217.05
8.0.220.0030.00317.00
8.0.210.0030.00516.97
8.0.200.0030.00316.97
8.0.190.0040.00416.97
8.0.180.0000.00716.93
8.0.170.0040.00417.05
8.0.160.0050.00317.04
8.0.150.0040.00416.91
8.0.140.0000.00716.88
8.0.130.0030.00313.36
8.0.120.0050.00216.96
8.0.110.0070.00016.90
8.0.100.0000.00716.84
8.0.90.0030.00516.98
8.0.80.0090.01017.04
8.0.70.0070.00017.05
8.0.60.0000.00716.98
8.0.50.0000.00716.98
8.0.30.0160.00317.20
8.0.20.0180.00417.40
8.0.10.0050.00317.01
8.0.00.0130.00516.83
7.4.330.0000.00515.55
7.4.320.0000.00616.65
7.4.300.0060.00016.55
7.4.290.0000.00716.66
7.4.280.0030.00616.55
7.4.270.0000.00716.57
7.4.260.0030.00316.50
7.4.250.0070.00016.50
7.4.240.0040.00416.55
7.4.230.0030.00316.64
7.4.220.0070.00016.58
7.4.210.0040.01116.56
7.4.200.0030.00516.76
7.4.160.0070.01016.63
7.4.140.0090.01217.86
7.4.130.0100.00716.76
7.4.120.0130.00716.60
7.4.110.0070.01416.61
7.4.100.0080.01516.70
7.4.90.0130.00316.45
7.4.80.0110.01119.39
7.4.70.0110.00716.67
7.4.60.0130.00416.50
7.4.50.0070.01016.41
7.4.40.0140.00316.62
7.4.00.0110.00315.13
7.3.330.0030.00213.29
7.3.320.0000.00713.25
7.3.310.0030.00616.43
7.3.300.0000.00616.43
7.3.290.0000.00716.40
7.3.280.0020.01416.36
7.3.260.0100.01116.36
7.3.240.0130.00616.42
7.3.230.0100.01016.71
7.3.210.0140.00316.63
7.3.200.0150.00316.70
7.3.190.0110.01216.27
7.3.180.0130.01016.61
7.3.170.0140.00416.72
7.3.160.0080.00816.45
7.2.330.0180.01516.55
7.2.320.0130.00416.46
7.2.310.0030.01416.55
7.2.300.0100.00716.86
7.2.290.0170.00716.46
7.2.110.0300.01014.87
7.2.100.0510.00314.87
7.2.90.0390.00314.96
7.2.80.0370.00614.98
7.2.70.0330.01015.18
7.2.60.0480.00615.22
7.2.50.0310.01015.12
7.2.40.0570.00714.90
7.2.30.0510.00315.24
7.2.20.0350.00915.00
7.2.10.0440.00715.22
7.2.00.0390.00614.93
7.1.230.0400.00714.00
7.1.220.0520.00314.00
7.1.210.0460.01313.90
7.1.200.0260.01513.99
7.1.190.0590.00713.94
7.1.180.0470.00014.01
7.1.170.0330.00713.98
7.1.160.0580.00713.66
7.1.150.0500.01014.09
7.1.140.0620.00813.77
7.1.130.0320.00713.86
7.1.120.0360.00713.92
7.1.110.0250.01014.11
7.1.100.0350.00614.01
7.1.90.0350.00613.69
7.1.80.0360.00713.93
7.1.70.1100.00613.93
7.1.60.0420.01632.23
7.1.50.0500.01331.96
7.1.40.0610.01432.00
7.1.30.0870.00732.11
7.1.20.0580.01031.90
7.1.10.0410.01014.13
7.1.00.0440.00314.09
5.6.380.0120.00314.33

preferences:
41.6 ms | 403 KiB | 5 Q