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 * 9; // 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:30 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.00716.86
8.3.50.0070.01122.06
8.3.40.0140.00719.13
8.3.30.0040.01119.21
8.3.20.0080.00020.35
8.3.10.0000.00723.71
8.3.00.0040.00419.18
8.2.180.0090.01225.92
8.2.170.0060.00922.96
8.2.160.0050.00920.24
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0050.00326.16
8.2.120.0000.00820.80
8.2.110.0060.00322.32
8.2.100.0050.00517.94
8.2.90.0040.00419.30
8.2.80.0050.00318.00
8.2.70.0000.00818.00
8.2.60.0080.00017.80
8.2.50.0030.00618.07
8.2.40.0080.00021.13
8.2.30.0030.00518.48
8.2.20.0040.00418.05
8.2.10.0000.00718.18
8.2.00.0030.00518.08
8.1.280.0060.00925.92
8.1.270.0030.00623.96
8.1.260.0050.00326.35
8.1.250.0060.00328.09
8.1.240.0030.00622.12
8.1.230.0070.00419.21
8.1.220.0050.00317.77
8.1.210.0000.00918.77
8.1.200.0000.01117.47
8.1.190.0000.00817.35
8.1.180.0000.00918.10
8.1.170.0030.00518.77
8.1.160.0040.00422.11
8.1.150.0050.00218.88
8.1.140.0050.00217.77
8.1.130.0030.00317.92
8.1.120.0050.00217.64
8.1.110.0040.00417.77
8.1.100.0030.00517.64
8.1.90.0030.00517.79
8.1.80.0070.00017.77
8.1.70.0070.00017.70
8.1.60.0030.00617.71
8.1.50.0000.00817.76
8.1.40.0060.00317.77
8.1.30.0040.00417.86
8.1.20.0050.00217.86
8.1.10.0000.00817.76
8.1.00.0000.00717.75
8.0.300.0090.00318.77
8.0.290.0040.00417.30
8.0.280.0000.00718.48
8.0.270.0050.00217.42
8.0.260.0030.00317.45
8.0.250.0000.00717.18
8.0.240.0000.00917.19
8.0.230.0040.00417.16
8.0.220.0020.00517.09
8.0.210.0000.00717.15
8.0.200.0030.00317.22
8.0.190.0000.00817.19
8.0.180.0070.00017.21
8.0.170.0040.00417.23
8.0.160.0000.00717.15
8.0.150.0080.00016.95
8.0.140.0030.00517.15
8.0.130.0000.00513.58
8.0.120.0040.00417.19
8.0.110.0000.00817.09
8.0.100.0000.00817.06
8.0.90.0000.00717.12
8.0.80.0030.01217.08
8.0.70.0000.00717.22
8.0.60.0040.00417.08
8.0.50.0040.00416.95
8.0.30.0140.00617.34
8.0.20.0130.00717.44
8.0.10.0000.00817.18
8.0.00.0100.00816.95
7.4.330.0000.00515.12
7.4.320.0060.00016.77
7.4.300.0050.00516.83
7.4.290.0000.00716.77
7.4.280.0060.00316.75
7.4.270.0040.00416.71
7.4.260.0050.00516.70
7.4.250.0080.00016.70
7.4.240.0040.00316.71
7.4.230.0030.00316.66
7.4.220.0130.01316.85
7.4.210.0060.00816.76
7.4.200.0040.00416.80
7.4.190.0030.00316.76
7.4.160.0080.00816.79
7.4.150.0070.01117.40
7.4.140.0080.01017.86
7.4.130.0100.00816.74
7.4.120.0070.01016.83
7.4.110.0040.01416.86
7.4.100.0060.01916.63
7.4.90.0120.00616.75
7.4.80.0120.00619.39
7.4.70.0130.00416.81
7.4.60.0100.00916.81
7.4.50.0000.00716.74
7.4.40.0170.00616.79
7.4.30.0040.01116.70
7.4.00.0070.01015.11
7.3.330.0050.00013.24
7.3.320.0040.00413.39
7.3.310.0020.00516.34
7.3.300.0050.00216.40
7.3.290.0000.01616.44
7.3.280.0080.00816.52
7.3.270.0070.01317.40
7.3.260.0070.01016.63
7.3.250.0070.01316.65
7.3.240.0030.01416.94
7.3.230.0030.01716.48
7.3.210.0090.00916.75
7.3.200.0070.01019.39
7.3.190.0080.00816.59
7.3.180.0070.01016.63
7.3.170.0060.01016.84
7.3.160.0150.00616.89
7.3.120.0070.01015.10
7.3.110.0040.01415.23
7.3.100.0070.00715.30
7.3.90.0090.00015.00
7.3.80.0070.00715.38
7.3.70.0120.00015.06
7.3.60.0040.00415.07
7.3.50.0070.00715.00
7.3.40.0090.00315.17
7.3.30.0100.00314.77
7.3.20.0040.00416.94
7.3.10.0060.00616.79
7.3.00.0080.00516.87
7.2.330.0120.00617.12
7.2.320.0130.01016.81
7.2.310.0080.00816.74
7.2.300.0090.00916.93
7.2.290.0030.01316.85
7.2.250.0060.01215.15
7.2.240.0060.01315.60
7.2.230.0060.01015.55
7.2.220.0030.00915.18
7.2.210.0030.00615.58
7.2.200.0070.00715.48
7.2.190.0060.00915.24
7.2.180.0030.01115.33
7.2.170.0070.00715.39
7.2.130.0050.00717.17
7.2.120.0030.00917.20
7.2.110.0050.00617.10
7.2.100.0040.00717.00
7.2.90.0080.00517.26
7.2.80.0030.01117.18
7.2.70.0040.01017.18
7.2.60.0060.00417.23
7.2.50.0070.00617.21
7.2.40.0050.00816.92
7.2.30.0030.00916.96
7.2.20.0040.00617.09
7.2.10.0070.00717.13
7.2.00.0040.00917.85
7.1.330.0080.00815.98
7.1.320.0030.00915.93
7.1.310.0030.01215.98
7.1.300.0000.01316.07
7.1.290.0070.00715.97
7.1.280.0060.00615.77
7.1.270.0060.00916.16
7.1.260.0040.01115.88
7.1.250.0050.00516.08
7.1.200.0090.00616.17
7.1.100.0130.00018.15
7.1.70.0000.00917.34
7.1.60.0060.01919.46
7.1.50.0070.00717.03
7.1.00.0000.08022.40
7.0.200.0100.00316.87
7.0.140.0000.07721.92
7.0.60.0070.08319.96
7.0.50.0030.05717.82
7.0.40.0130.08020.03
7.0.30.0200.05020.20
7.0.20.0270.08020.13
7.0.10.0100.08720.13
7.0.00.0070.05020.11
5.6.280.0070.06720.87
5.6.210.0030.06020.50
5.6.200.0070.06018.13
5.6.190.0030.09020.77
5.6.180.0200.07720.42
5.6.170.0230.03720.33
5.6.160.0070.06320.41
5.6.150.0100.04318.13
5.6.140.0100.05718.09
5.6.130.0030.04718.21
5.6.120.0100.08321.15
5.6.110.0030.08321.11
5.6.100.0070.07320.98
5.6.90.0100.06720.98
5.6.80.0100.08020.49
5.5.350.0000.04320.44
5.5.340.0070.07717.98
5.5.330.0100.06720.37
5.5.320.0270.05320.34
5.5.310.0300.07020.24
5.5.300.0030.07317.97
5.5.290.0070.04717.87
5.5.280.0070.04020.76
5.5.270.0070.09020.77
5.5.260.0070.08020.68
5.5.250.0200.07720.59
5.5.240.0000.06020.27
5.4.450.0600.06019.41
5.4.440.0100.08019.61
5.4.430.0600.06019.43
5.4.420.0830.06319.51
5.4.410.1070.06719.35
5.4.400.1000.05319.32
5.4.390.0900.05019.03
5.4.380.0330.06018.45
5.4.370.0430.06018.70
5.4.360.0370.08018.68
5.4.350.0370.05718.58
5.4.340.0330.05718.73
5.4.320.0070.03812.46
5.4.310.0070.03912.46
5.4.300.0110.03812.46
5.4.290.0100.04712.46
5.4.280.0100.05012.36
5.4.270.0120.05612.36
5.4.260.0060.05712.36
5.4.250.0120.05012.36
5.4.240.0070.05412.36
5.4.230.0110.05212.35
5.4.220.0200.06712.35
5.4.210.0080.05312.35
5.4.200.0090.05512.35
5.4.190.0110.05112.34
5.4.180.0090.05512.34
5.4.170.0090.05412.36
5.4.160.0080.05212.35
5.4.150.0090.05112.35
5.4.140.0130.04912.03
5.4.130.0080.05012.02
5.4.120.0090.05211.98
5.4.110.0110.04911.98
5.4.100.0080.04911.97
5.4.90.0090.05411.97
5.4.80.0070.05611.98
5.4.70.0080.05211.97
5.4.60.0100.05111.97
5.4.50.0090.05111.97
5.4.40.0100.05111.96
5.4.30.0070.05111.96
5.4.20.0100.05311.96
5.4.10.0110.05011.96
5.4.00.0090.05111.45
5.3.290.0090.03812.80
5.3.280.0130.04912.71
5.3.270.0130.05512.72
5.3.260.0140.05712.72
5.3.250.0070.06312.72
5.3.240.0070.06212.72
5.3.230.0120.05212.71
5.3.220.0110.05412.68
5.3.210.0090.06212.68
5.3.200.0110.05712.68
5.3.190.0110.05912.68
5.3.180.0160.07412.67
5.3.170.0070.05812.66
5.3.160.0070.05912.67
5.3.150.0160.05812.68
5.3.140.0180.07112.66
5.3.130.0170.11012.66
5.3.120.0100.05612.66
5.3.110.0080.05912.66
5.3.100.0100.05412.11
5.3.90.0240.11512.08
5.3.80.0270.08312.07
5.3.70.0080.04612.08
5.3.60.0100.04512.07
5.3.50.0120.05412.00
5.3.40.0130.04712.00
5.3.30.0070.05311.96
5.3.20.0120.04611.74
5.3.10.0050.04311.71
5.3.00.0070.04311.69
5.2.170.0050.0389.20
5.2.160.0050.0349.20
5.2.150.0090.0359.20
5.2.140.0070.0429.20
5.2.130.0040.0419.16
5.2.120.0040.0329.16
5.2.110.0050.0309.17
5.2.100.0030.0379.16
5.2.90.0100.0339.16
5.2.80.0060.0429.16
5.2.70.0090.0359.16
5.2.60.0020.0439.11
5.2.50.0060.0409.08
5.2.40.0050.0359.05
5.2.30.0060.0399.04
5.2.20.0090.0339.02
5.2.10.0080.0318.95
5.2.00.0060.0358.80
5.1.60.0060.0288.08
5.1.50.0070.0308.08
5.1.40.0060.0288.06
5.1.30.0080.0318.41
5.1.20.0090.0338.43
5.1.10.0040.0388.16
5.1.00.0090.0318.16
5.0.50.0080.0266.64
5.0.40.0090.0286.50
5.0.30.0060.0416.31
5.0.20.0050.0266.29
5.0.10.0100.0236.26
5.0.00.0060.0406.25
4.4.90.0040.0234.78
4.4.80.0070.0224.75
4.4.70.0080.0194.75
4.4.60.0040.0234.75
4.4.50.0050.0214.77
4.4.40.0030.0434.71
4.4.30.0040.0224.76
4.4.20.0040.0264.85
4.4.10.0050.0214.85
4.4.00.0040.0334.76
4.3.110.0070.0214.67
4.3.100.0050.0244.66
4.3.90.0050.0214.63
4.3.80.0050.0324.58
4.3.70.0070.0324.63
4.3.60.0100.0314.63
4.3.50.0050.0214.63
4.3.40.0040.0334.54
4.3.30.0050.0213.28
4.3.20.0040.0213.26
4.3.10.0030.0223.23
4.3.00.0070.0177.36

preferences:
42.67 ms | 401 KiB | 5 Q