3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Initial datetimes $date1 = new DateTime('2014-06-25 11:30'); $date2 = new DateTime('2014-06-27 11:30'); // 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: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.0100.01016.75
8.3.50.0170.00922.04
8.3.40.0090.00619.07
8.3.30.0040.01119.09
8.3.20.0080.00020.38
8.3.10.0080.00023.48
8.3.00.0040.00419.19
8.2.180.0070.00716.88
8.2.170.0090.00622.96
8.2.160.0110.00320.52
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0060.00320.74
8.2.110.0160.00321.19
8.2.100.0120.00017.97
8.2.90.0030.00619.38
8.2.80.0040.00417.97
8.2.70.0030.00617.85
8.2.60.0000.00818.05
8.2.50.0050.00318.07
8.2.40.0050.00320.97
8.2.30.0040.00418.37
8.2.20.0050.00317.98
8.2.10.0070.00018.39
8.2.00.0040.00417.89
8.1.280.0090.00625.92
8.1.270.0080.00023.92
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0090.00021.39
8.1.230.0110.00017.76
8.1.220.0080.00017.91
8.1.210.0090.00018.77
8.1.200.0030.00617.60
8.1.190.0040.00417.38
8.1.180.0030.00518.10
8.1.170.0000.00818.91
8.1.160.0000.00722.10
8.1.150.0080.00018.97
8.1.140.0030.00517.72
8.1.130.0070.00017.99
8.1.120.0000.00717.80
8.1.110.0000.00717.77
8.1.100.0040.00317.78
8.1.90.0040.00417.63
8.1.80.0000.00717.63
8.1.70.0000.00817.61
8.1.60.0040.00417.69
8.1.50.0000.00817.76
8.1.40.0080.00017.70
8.1.30.0000.00817.93
8.1.20.0030.00517.74
8.1.10.0030.00617.81
8.1.00.0000.00817.78
8.0.300.0000.00718.77
8.0.290.0040.00416.88
8.0.280.0000.00718.54
8.0.270.0050.00317.31
8.0.260.0030.00317.44
8.0.250.0070.00017.26
8.0.240.0030.00617.26
8.0.230.0060.00317.23
8.0.220.0000.00717.06
8.0.210.0070.00017.18
8.0.200.0070.00017.14
8.0.190.0000.00817.22
8.0.180.0020.00517.20
8.0.170.0000.00817.26
8.0.160.0040.00417.12
8.0.150.0050.00317.13
8.0.140.0000.00817.13
8.0.130.0050.00013.50
8.0.120.0080.00017.05
8.0.110.0000.00817.18
8.0.100.0000.00817.13
8.0.90.0080.00017.13
8.0.80.0090.00617.14
8.0.70.0000.00716.97
8.0.60.0000.00817.00
8.0.50.0000.00717.15
8.0.30.0080.01117.25
8.0.20.0120.00717.45
8.0.10.0000.00817.27
8.0.00.0070.01217.03
7.4.330.0020.00215.21
7.4.320.0000.00716.72
7.4.300.0100.00016.73
7.4.290.0000.00716.73
7.4.280.0060.00316.64
7.4.270.0000.00716.71
7.4.260.0000.00716.82
7.4.250.0000.00816.77
7.4.240.0000.00716.80
7.4.230.0070.00016.79
7.4.220.0040.01416.73
7.4.210.0050.01116.68
7.4.200.0000.00716.75
7.4.190.0000.00716.91
7.4.160.0070.01016.77
7.4.150.0110.00617.40
7.4.140.0130.00517.86
7.4.130.0120.00816.73
7.4.120.0070.01316.75
7.4.110.0060.01216.67
7.4.100.0060.01316.95
7.4.90.0030.02016.57
7.4.80.0030.01319.39
7.4.70.0070.01516.65
7.4.60.0060.01216.79
7.4.50.0020.00216.80
7.4.40.0100.00616.80
7.4.30.0030.01316.52
7.4.00.0100.00315.14
7.3.330.0030.00313.23
7.3.320.0000.00613.47
7.3.310.0030.00316.55
7.3.300.0040.00416.32
7.3.290.0040.01116.43
7.3.280.0130.00616.52
7.3.270.0130.00717.40
7.3.260.0170.00716.59
7.3.250.0160.00716.66
7.3.240.0130.00316.71
7.3.230.0070.01716.61
7.3.210.0100.00716.67
7.3.200.0140.00719.39
7.3.190.0120.00616.50
7.3.180.0110.00716.54
7.3.170.0060.01316.73
7.3.160.0060.00916.62
7.3.120.0100.00715.02
7.3.10.0080.00816.61
7.3.00.0080.00816.89
7.2.330.0090.00916.99
7.2.320.0070.01017.06
7.2.310.0060.01117.11
7.2.300.0090.01316.87
7.2.290.0080.00816.84
7.2.130.0070.00716.87
7.2.120.0000.01516.94
7.2.110.0110.00717.05
7.2.100.0080.00616.81
7.2.90.0060.01117.02
7.2.80.0120.00716.75
7.2.70.0080.01217.05
7.2.60.0070.00517.04
7.2.50.0250.00617.00
7.2.40.0040.01116.96
7.2.30.0100.00717.21
7.2.20.0040.01117.04
7.2.10.0050.00517.30
7.2.00.0070.00617.10
7.1.250.0030.01016.15
7.1.200.0080.00316.05
7.1.70.0050.00517.27
7.1.60.0060.01919.46
7.1.50.0000.01317.23
7.1.00.0070.07322.51
7.0.200.0030.00616.97
7.0.140.0030.07321.92
7.0.60.0130.07719.94
7.0.50.0130.06717.79
7.0.40.0030.05020.20
7.0.30.0200.04020.34
7.0.20.0230.05020.12
7.0.10.0070.06320.30
7.0.00.0030.09720.04
5.6.280.0000.07721.15
5.6.210.0100.05020.67
5.6.200.0130.07018.22
5.6.190.0100.03720.61
5.6.180.0200.07320.61
5.6.170.0070.05020.41
5.6.160.0070.08320.54
5.6.150.0030.08018.18
5.6.140.0130.06718.11
5.6.130.0070.03718.21
5.6.120.0130.06720.97
5.6.110.0230.06721.11
5.6.100.0200.07321.02
5.6.90.0000.08021.06
5.6.80.0130.07720.29
5.5.350.0000.06320.43
5.5.340.0030.08717.99
5.5.330.0070.08320.44
5.5.320.0330.05320.27
5.5.310.0070.05020.24
5.5.300.0070.05317.94
5.5.290.0100.07018.02
5.5.280.0100.08020.73
5.5.270.0000.04720.98
5.5.260.0000.07320.88
5.5.250.0000.04720.50
5.5.240.0030.07720.16
5.4.450.0100.05719.32
5.4.440.0700.06319.63
5.4.430.0200.08019.22
5.4.420.0800.05319.25
5.4.410.0770.06719.10
5.4.400.1030.05719.34
5.4.390.0900.07018.90
5.4.380.0270.06318.68
5.4.370.0200.06718.68
5.4.360.0370.04718.79
5.4.350.0230.06318.48
5.4.340.0370.05018.62
5.4.320.0080.04612.46
5.4.310.0060.03912.46
5.4.300.0090.03612.46
5.4.290.0070.03912.46
5.4.280.0070.05912.36
5.4.270.0100.03912.36
5.4.260.0080.04212.36
5.4.250.0100.04512.36
5.4.240.0080.03912.36
5.4.230.0070.04112.35
5.4.220.0060.04712.35
5.4.210.0090.04212.35
5.4.200.0080.04212.35
5.4.190.0060.04312.35
5.4.180.0070.04512.34
5.4.170.0100.05112.36
5.4.160.0080.04412.35
5.4.150.0090.03912.35
5.4.140.0090.03512.03
5.4.130.0060.03712.02
5.4.120.0050.03811.98
5.4.110.0080.03911.98
5.4.100.0140.04011.97
5.4.90.0080.03711.98
5.4.80.0090.03711.97
5.4.70.0100.03111.97
5.4.60.0090.03211.98
5.4.50.0070.04211.97
5.4.40.0070.04111.96
5.4.30.0050.04411.96
5.4.20.0070.05211.96
5.4.10.0090.05111.96
5.4.00.0060.05411.45
5.3.290.0060.04212.80
5.3.280.0080.03912.71
5.3.270.0100.04712.73
5.3.260.0040.05712.72
5.3.250.0070.03712.72
5.3.240.0080.03712.72
5.3.230.0110.04112.71
5.3.220.0090.05412.68
5.3.210.0060.05012.68
5.3.200.0090.03612.68
5.3.190.0060.04512.68
5.3.180.0090.03312.67
5.3.170.0040.03812.67
5.3.160.0040.03912.68
5.3.150.0030.04112.68
5.3.140.0070.05412.66
5.3.130.0070.04812.66
5.3.120.0050.03912.66
5.3.110.0070.03912.66
5.3.100.0060.03712.12
5.3.90.0050.03712.08
5.3.80.0070.03912.07
5.3.70.0090.04312.07
5.3.60.0050.04512.06
5.3.50.0070.04212.00
5.3.40.0080.04012.00
5.3.30.0050.05111.96
5.3.20.0050.04411.74
5.3.10.0120.04711.71
5.3.00.0060.04611.70
5.2.170.0090.0309.20
5.2.160.0040.0399.20
5.2.150.0080.0349.20
5.2.140.0080.0339.20
5.2.130.0070.0289.16
5.2.120.0080.0279.16
5.2.110.0090.0279.16
5.2.100.0050.0309.16
5.2.90.0070.0289.16
5.2.80.0050.0309.16
5.2.70.0040.0359.16
5.2.60.0080.0289.11
5.2.50.0080.0349.08
5.2.40.0070.0289.06
5.2.30.0040.0339.03
5.2.20.0090.0349.02
5.2.10.0050.0368.94
5.2.00.0070.0348.80
5.1.60.0050.0238.09
5.1.50.0040.0258.08
5.1.40.0050.0298.06
5.1.30.0080.0348.41
5.1.20.0080.0288.43
5.1.10.0040.0278.16
5.1.00.0040.0278.16
5.0.50.0070.0266.64
5.0.40.0100.0256.50
5.0.30.0040.0346.31
5.0.20.0040.0236.28
5.0.10.0070.0186.26
5.0.00.0040.0346.25
4.4.90.0060.0184.78
4.4.80.0080.0224.76
4.4.70.0040.0194.75
4.4.60.0050.0164.75
4.4.50.0010.0184.77
4.4.40.0090.0384.71
4.4.30.0030.0194.76
4.4.20.0040.0184.84
4.4.10.0050.0314.85
4.4.00.0030.0324.76
4.3.110.0040.0304.67
4.3.100.0030.0204.66
4.3.90.0070.0264.63
4.3.80.0010.0284.59
4.3.70.0130.0594.63
4.3.60.0050.0174.63
4.3.50.0060.0144.63
4.3.40.0030.0284.54
4.3.30.0060.0153.28
4.3.20.0040.0143.25
4.3.10.0030.0203.22
4.3.00.0000.0237.36

preferences:
45.04 ms | 401 KiB | 5 Q