3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Initial datetimes $date1 = new DateTime('2012-03-22 11:29:16'); $date2 = new DateTime('2012-03-24 03:58:58'); // Set first datetime to midnight of next day $start = clone $date1; $start->modify('+1 day'); $start->modify('midnight'); // Set second datetime to midnight of that day $end = clone $date2; $end->modify('midnight'); // Count the number of full days between both dates $days = 0; // Loop through each day between two dates $interval = new DateInterval('P1D'); $period = new DatePeriod($start, $interval, $end); foreach ($period as $dt) { // If it is a weekend don't count it if (!in_array($dt->format('l'), array('Saturday', 'Sunday'))) { $days++; } } // Assume 8 hour workdays $hours = $days * 8; // Get the number of hours worked on the first day $date1->modify('5:30 PM'); $diff = $date1->diff($start); $hours += $diff->h; // Get the number of hours worked the second day $date1->modify('8 AM'); $diff = $date2->diff($end); $hours += $diff->h; echo $hours;

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.60.0070.00718.38
8.3.50.0110.00622.24
8.3.40.0090.00618.96
8.3.30.0110.00419.29
8.3.20.0070.00020.29
8.3.10.0060.00323.48
8.3.00.0060.00319.78
8.2.180.0030.01218.41
8.2.170.0140.00722.96
8.2.160.0040.01122.11
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0040.00420.98
8.2.110.0030.00721.11
8.2.100.0070.00417.97
8.2.90.0050.00318.09
8.2.80.0100.00019.23
8.2.70.0030.00618.17
8.2.60.0050.00318.41
8.2.50.0040.00818.10
8.2.40.0000.00820.55
8.2.30.0000.01018.33
8.2.20.0040.00417.94
8.2.10.0070.00018.34
8.2.00.0000.00817.97
8.1.280.0100.00725.92
8.1.270.0090.00023.73
8.1.260.0050.00226.35
8.1.250.0080.00028.09
8.1.240.0030.00622.24
8.1.230.0040.00722.78
8.1.220.0030.00617.78
8.1.210.0040.00419.05
8.1.200.0040.00417.72
8.1.190.0030.00617.48
8.1.180.0030.00619.21
8.1.170.0060.00318.85
8.1.160.0050.00319.00
8.1.150.0040.00419.07
8.1.140.0000.00717.66
8.1.130.0070.00017.90
8.1.120.0000.00717.72
8.1.110.0020.00517.78
8.1.100.0030.00517.72
8.1.90.0000.00717.82
8.1.80.0030.00317.68
8.1.70.0000.00717.72
8.1.60.0060.00317.63
8.1.50.0000.00817.63
8.1.40.0040.00417.73
8.1.30.0000.00817.78
8.1.20.0000.00817.86
8.1.10.0050.00217.68
8.1.00.0040.00417.89
8.0.300.0000.00720.27
8.0.290.0070.00316.88
8.0.280.0000.00818.66
8.0.270.0070.00017.32
8.0.260.0040.00417.33
8.0.250.0070.00017.23
8.0.240.0060.00017.28
8.0.230.0070.00017.30
8.0.220.0050.00217.16
8.0.210.0030.00517.06
8.0.200.0030.00317.22
8.0.190.0000.00717.11
8.0.180.0060.00617.16
8.0.170.0030.00617.17
8.0.160.0030.00517.26
8.0.150.0000.00717.10
8.0.140.0050.00317.16
8.0.130.0050.00013.63
8.0.120.0000.00817.05
8.0.110.0070.00017.08
8.0.100.0040.00417.20
8.0.90.0050.00317.17
8.0.80.0000.01517.19
8.0.70.0000.00716.95
8.0.60.0050.00217.06
8.0.50.0050.00216.99
8.0.30.0090.01117.22
8.0.20.0110.00817.46
8.0.10.0050.00217.38
8.0.00.0070.01416.94
7.4.330.0020.00215.18
7.4.320.0060.00016.62
7.4.300.0060.00016.82
7.4.290.0000.00816.71
7.4.280.0000.00916.64
7.4.270.0070.00016.72
7.4.260.0030.00316.63
7.4.250.0020.00516.71
7.4.240.0060.00116.80
7.4.230.0030.00316.70
7.4.220.0030.01716.59
7.4.210.0050.01016.75
7.4.200.0040.00316.86
7.4.160.0080.00816.60
7.4.150.0250.00017.40
7.4.140.0110.01117.86
7.4.130.0100.00816.78
7.4.120.0090.00816.79
7.4.110.0100.00716.93
7.4.100.0070.01016.88
7.4.90.0100.00516.57
7.4.80.0140.01019.39
7.4.70.0110.00616.62
7.4.60.0060.01216.71
7.4.50.0030.00616.54
7.4.40.0040.01216.86
7.4.30.0070.01016.75
7.4.00.0110.00414.96
7.3.330.0000.00613.40
7.3.320.0000.00513.30
7.3.310.0040.00416.33
7.3.300.0070.00016.35
7.3.290.0070.00716.44
7.3.280.0110.00616.48
7.3.270.0140.00417.40
7.3.260.0030.01916.65
7.3.250.0160.00516.52
7.3.240.0090.01016.70
7.3.230.0180.00616.66
7.3.210.0110.00716.68
7.3.200.0030.01316.66
7.3.190.0100.01016.46
7.3.180.0080.00816.49
7.3.170.0130.01016.53
7.3.160.0130.00616.63
7.3.120.0040.01115.20
7.2.330.0150.01117.07
7.2.320.0090.00917.00
7.2.310.0040.01517.10
7.2.300.0100.00717.03
7.2.290.0060.01316.90
7.2.60.0030.01316.97
7.2.00.0100.00719.80
7.1.200.0090.00615.97
7.1.100.0070.01018.21
7.1.70.0000.00817.52
7.1.60.0060.00619.70
7.1.50.0280.01734.80
7.1.00.0030.07722.48
7.0.200.0000.00817.13
7.0.140.0130.06321.97
7.0.100.0200.05020.02
7.0.90.0100.04019.89
7.0.80.0100.03719.84
7.0.70.0200.04019.88
7.0.60.0230.08019.90
7.0.50.0270.08320.26
7.0.40.0070.03720.10
7.0.30.0030.06720.10
7.0.20.0030.05320.14
7.0.10.0030.07020.07
7.0.00.0000.05020.05
5.6.280.0030.07021.11
5.6.250.0000.04720.62
5.6.240.0030.04320.65
5.6.230.0070.07320.59
5.6.220.0100.05020.63
5.6.210.0100.03320.62
5.6.200.0030.04021.05
5.6.190.0100.03721.04
5.6.180.0000.07021.00
5.6.170.0030.04320.98
5.6.160.0070.04321.01
5.6.150.0030.06021.04
5.6.140.0000.04720.99
5.6.130.0070.04020.91
5.6.120.0030.04321.00
5.6.110.0100.03320.96
5.6.100.0070.04020.98
5.6.90.0030.05020.98
5.6.80.0030.04720.36
5.6.70.0070.08020.37
5.6.60.0070.04320.34
5.6.50.0030.09020.43
5.6.40.0130.07320.43
5.6.30.0030.08320.43
5.6.20.0170.06320.20
5.6.10.0170.07020.27
5.6.00.0070.08020.36
5.5.380.0070.04320.47
5.5.370.0030.04020.31
5.5.360.0070.03720.39
5.5.350.0100.04020.36
5.5.340.0070.06720.80
5.5.330.0100.03320.60
5.5.320.0100.05720.86
5.5.310.0000.04720.72
5.5.300.0100.04720.57
5.5.290.0030.04320.87
5.5.280.0030.04720.71
5.5.270.0100.06020.85
5.5.260.0030.04020.85
5.5.250.0130.03020.66
5.5.240.0000.04020.22
5.5.230.0030.06020.22
5.5.220.0000.08320.07
5.5.210.0030.08020.25
5.5.200.0230.06719.95
5.5.190.0170.06319.95
5.5.180.0070.05720.11
5.5.160.0070.07720.19
5.5.150.0070.04719.95
5.5.140.0070.04320.21
5.5.130.0100.07720.11
5.5.120.0030.08020.04
5.5.110.0000.08020.23
5.5.100.0100.07020.13
5.5.90.0100.06319.97
5.5.80.0170.06320.04
5.5.70.0070.07320.01
5.5.60.0130.07020.05
5.5.50.0100.08020.05
5.5.40.0070.07720.10
5.5.30.0030.08019.98
5.5.20.0100.04720.04
5.5.10.0030.08020.07
5.5.00.0030.08319.98
5.4.450.0030.04319.29
5.4.440.0030.07719.55
5.4.430.0030.04019.45
5.4.420.0000.05019.44
5.4.410.0030.04319.26
5.4.400.0100.05319.15
5.4.390.0030.04018.96
5.4.380.0100.03019.04
5.4.370.0070.08018.82
5.4.360.0070.08018.98
5.4.350.0130.06318.95
5.4.340.0000.08018.81
5.4.320.0070.04719.03
5.4.310.0100.05718.93
5.4.300.0030.08018.79
5.4.290.0100.06019.23
5.4.280.0100.07018.81
5.4.270.0030.05718.98
5.4.260.0100.06719.09
5.4.250.0030.08318.96
5.4.240.0070.08019.14
5.4.230.0070.07719.07
5.4.220.0070.08019.04
5.4.210.0200.06318.79
5.4.200.0100.07019.13
5.4.190.0030.07719.13
5.4.180.0100.07019.12
5.4.170.0030.07318.80
5.4.160.0130.04019.10
5.4.150.0030.07718.88
5.4.140.0030.08316.40
5.4.130.0100.06316.28
5.4.120.0100.06316.38
5.4.110.0100.07016.40
5.4.100.0100.06316.44
5.4.90.0100.06016.45
5.4.80.0070.07016.28
5.4.70.0070.05016.28
5.4.60.0070.06716.25
5.4.50.0100.06716.41
5.4.40.0100.06316.45
5.4.30.0070.03716.36
5.4.20.0030.07016.36
5.4.10.0100.07016.46
5.4.00.0130.06315.79
5.3.290.0070.07314.61
5.3.280.0070.07714.59
5.3.270.0070.07714.47
5.3.260.0070.05314.48
5.3.250.0070.04314.48
5.3.240.0030.07714.63
5.3.230.0030.08014.55
5.3.220.0100.06014.57
5.3.210.0000.05014.43
5.3.200.0000.04714.56
5.3.190.0100.07014.56
5.3.180.0100.07314.52
5.3.170.0070.07714.58
5.3.160.0170.05714.57
5.3.150.0070.07314.43
5.3.140.0100.07014.56
5.3.130.0030.07714.57
5.3.120.0130.07014.54
5.3.110.0000.04014.53
5.3.100.0030.03714.04
5.3.90.0070.07713.88
5.3.80.0070.07314.02
5.3.70.0100.07013.81
5.3.60.0070.07013.98
5.3.50.0100.07013.82
5.3.40.0070.07713.92
5.3.30.0070.07313.92
5.3.20.0070.06713.57
5.3.10.0070.07313.62
5.3.00.0070.04313.61
5.2.170.0100.05711.22
5.2.160.0130.03711.00
5.2.150.0070.05711.20
5.2.140.0030.06011.15
5.2.130.0130.03711.11
5.2.120.0070.03311.06
5.2.110.0000.04010.91
5.2.100.0130.04711.03
5.2.90.0070.03011.11
5.2.80.0030.06311.09
5.2.70.0070.05710.90
5.2.60.0070.05011.05
5.2.50.0070.04710.89
5.2.40.0130.05310.86
5.2.30.0100.05010.99
5.2.20.0030.03310.98
5.2.10.0070.03710.94
5.2.00.0100.05310.78
5.1.60.0070.05310.07
5.1.50.0100.04710.02
5.1.40.0070.0509.99
5.1.30.0070.05310.40
5.1.20.0030.05710.28
5.1.10.0000.04310.13
5.1.00.0030.03310.13
5.0.50.0000.0508.59
5.0.40.0000.0478.45
5.0.30.0030.0578.27
5.0.20.0070.0438.20
5.0.10.0030.0438.23
5.0.00.0070.0608.21
4.4.90.0100.0277.05
4.4.80.0000.0277.05
4.4.70.0070.0307.05
4.4.60.0030.0337.05
4.4.50.0000.0377.05
4.4.40.0030.0537.05
4.4.30.0070.0337.05
4.4.20.0070.0407.05
4.4.10.0000.0377.05
4.4.00.0030.0337.05
4.3.110.0000.0377.05
4.3.100.0030.0307.05
4.3.90.0000.0207.05
4.3.80.0030.0507.05
4.3.70.0000.0207.05
4.3.60.0030.0337.05
4.3.50.0000.0207.05
4.3.40.0100.0437.05
4.3.30.0030.0277.05
4.3.20.0030.0337.05
4.3.10.0000.0377.05
4.3.00.0000.0337.05

preferences:
46.42 ms | 401 KiB | 5 Q