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 12: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 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.40.0070.00718.88
8.3.30.0090.00619.29
8.3.20.0040.00420.39
8.3.10.0070.00023.51
8.3.00.0040.00419.08
8.2.170.0130.00722.96
8.2.160.0070.00720.53
8.2.150.0050.00224.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0000.00820.91
8.2.110.0110.00719.33
8.2.100.0110.00017.97
8.2.90.0040.00419.48
8.2.80.0050.00317.97
8.2.70.0090.00018.00
8.2.60.0050.00318.13
8.2.50.0050.00318.07
8.2.40.0000.00920.96
8.2.30.0060.00318.53
8.2.20.0000.00818.09
8.2.10.0000.00818.18
8.2.00.0040.00417.97
8.1.270.0090.00023.96
8.1.260.0090.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00321.37
8.1.230.0120.00017.64
8.1.220.0030.00517.77
8.1.210.0090.00018.77
8.1.200.0030.00617.59
8.1.190.0040.00417.60
8.1.180.0040.00418.10
8.1.170.0000.00818.91
8.1.160.0000.00722.03
8.1.150.0000.00718.93
8.1.140.0020.00517.74
8.1.130.0030.00317.93
8.1.120.0030.00517.77
8.1.110.0070.00017.75
8.1.100.0000.00817.80
8.1.90.0050.00317.64
8.1.80.0030.00517.69
8.1.70.0030.00317.71
8.1.60.0030.00617.81
8.1.50.0030.00517.78
8.1.40.0000.00817.73
8.1.30.0040.00417.79
8.1.20.0040.00417.87
8.1.10.0030.00617.86
8.1.00.0030.00517.79
8.0.300.0000.00818.77
8.0.290.0030.00617.00
8.0.280.0000.00718.60
8.0.270.0070.00017.29
8.0.260.0000.00617.42
8.0.250.0000.00717.16
8.0.240.0040.00417.23
8.0.230.0000.00717.23
8.0.220.0040.00417.07
8.0.210.0000.00717.21
8.0.200.0030.00317.25
8.0.190.0000.00717.11
8.0.180.0000.00817.22
8.0.170.0040.00417.19
8.0.160.0030.00317.05
8.0.150.0030.00517.14
8.0.140.0030.00617.02
8.0.130.0000.00513.48
8.0.120.0000.00817.14
8.0.110.0070.00017.20
8.0.100.0070.00017.28
8.0.90.0040.00417.03
8.0.80.0090.00617.20
8.0.70.0000.00717.29
8.0.60.0050.00217.05
8.0.50.0030.00517.29
8.0.30.0070.01217.36
8.0.20.0110.01117.40
8.0.10.0040.00417.35
8.0.00.0050.01216.95
7.4.330.0020.00215.20
7.4.320.0000.00716.63
7.4.300.0040.00416.72
7.4.290.0030.00316.71
7.4.280.0050.00516.58
7.4.270.0000.00716.65
7.4.260.0070.00316.73
7.4.250.0040.00416.79
7.4.240.0030.00516.67
7.4.230.0040.00416.91
7.4.220.0070.01116.69
7.4.210.0090.00916.79
7.4.200.0000.00716.85
7.4.190.0000.00716.91
7.4.160.0080.00716.66
7.4.150.0120.00617.40
7.4.140.0120.00617.86
7.4.130.0100.01116.74
7.4.120.0050.01216.71
7.4.110.0100.01016.80
7.4.100.0100.01016.88
7.4.90.0060.01316.77
7.4.80.0160.00319.39
7.4.70.0060.01216.82
7.4.60.0120.00616.61
7.4.50.0000.00916.89
7.4.40.0120.00416.73
7.4.30.0130.00316.75
7.4.00.0070.00414.95
7.3.330.0030.00313.26
7.3.320.0030.00413.20
7.3.310.0070.00016.37
7.3.300.0070.00016.59
7.3.290.0090.00616.51
7.3.280.0090.01116.50
7.3.270.0120.01217.40
7.3.260.0100.00716.77
7.3.250.0120.01016.56
7.3.240.0140.00316.85
7.3.230.0110.00516.55
7.3.210.0140.00716.44
7.3.200.0100.00619.39
7.3.190.0100.00716.54
7.3.180.0060.01016.57
7.3.170.0000.01716.87
7.3.160.0120.00316.46
7.3.120.0120.00614.81
7.3.10.0040.01516.58
7.3.00.0150.00716.66
7.2.330.0140.00416.95
7.2.320.0150.00916.76
7.2.310.0100.00716.88
7.2.300.0100.00717.05
7.2.290.0110.00616.93
7.2.130.0110.00616.89
7.2.120.0080.00817.16
7.2.110.0160.00317.27
7.2.100.0090.00616.85
7.2.90.0140.01417.00
7.2.80.0070.01117.20
7.2.70.0170.00317.24
7.2.60.0100.00717.05
7.2.50.0120.00417.06
7.2.40.0000.01417.30
7.2.30.0000.00917.07
7.2.20.0000.01617.31
7.2.10.0080.00917.04
7.2.00.0070.00918.46
7.1.250.0090.01216.14
7.1.100.0040.00718.47
7.1.70.0030.00617.44
7.1.60.0070.01819.46
7.1.50.0030.00917.27
7.1.00.0030.07322.36
7.0.200.0050.00217.04
7.0.140.0070.07322.18
7.0.60.0070.04320.05
7.0.50.0130.07717.88
7.0.40.0070.06020.23
7.0.30.0200.04020.02
7.0.20.0300.05720.30
7.0.10.0230.07020.16
7.0.00.0030.08720.01
5.6.280.0030.07321.05
5.6.210.0070.08320.52
5.6.200.0170.06718.11
5.6.190.0100.03720.61
5.6.180.0170.04320.68
5.6.170.0100.04720.51
5.6.160.0200.07720.50
5.6.150.0070.08718.19
5.6.140.0000.05018.12
5.6.130.0000.04318.21
5.6.120.0230.07021.00
5.6.110.0130.07321.09
5.6.100.0070.08020.98
5.6.90.0070.05720.97
5.6.80.0030.04020.41
5.5.350.0000.05720.41
5.5.340.0030.04017.98
5.5.330.0000.05020.41
5.5.320.0330.06720.29
5.5.310.0130.04320.21
5.5.300.0030.08318.01
5.5.290.0070.07717.95
5.5.280.0070.08320.81
5.5.270.0030.04320.77
5.5.260.0230.07020.96
5.5.250.0130.06720.59
5.5.240.0030.07720.15
5.4.450.0500.06019.63
5.4.440.0270.06019.29
5.4.430.0770.05719.55
5.4.420.0930.06719.42
5.4.410.1230.06319.50
5.4.400.0870.06319.04
5.4.390.1130.07719.23
5.4.380.0400.05318.66
5.4.370.0630.06718.74
5.4.360.0400.07718.72
5.4.350.0430.06318.68
5.4.340.0400.05718.58
5.4.320.0040.04612.46
5.4.310.0080.05512.46
5.4.300.0060.03812.46
5.4.290.0060.03912.46
5.4.280.0090.03212.36
5.4.270.0060.03712.36
5.4.260.0050.04012.36
5.4.250.0090.03612.36
5.4.240.0050.04512.36
5.4.230.0040.04812.35
5.4.220.0080.03512.35
5.4.210.0050.03712.35
5.4.200.0100.03312.35
5.4.190.0070.03612.35
5.4.180.0080.03412.35
5.4.170.0080.03412.36
5.4.160.0060.03612.35
5.4.150.0060.03512.35
5.4.140.0040.03812.03
5.4.130.0030.03912.02
5.4.120.0090.03311.98
5.4.110.0050.03811.98
5.4.100.0070.03711.97
5.4.90.0050.03811.97
5.4.80.0070.04011.98
5.4.70.0040.04111.97
5.4.60.0070.03411.97
5.4.50.0080.05011.97
5.4.40.0070.06211.96
5.4.30.0110.04911.96
5.4.20.0090.04411.95
5.4.10.0080.03511.96
5.4.00.0060.05811.45
5.3.290.0090.04612.80
5.3.280.0110.04512.71
5.3.270.0080.04612.72
5.3.260.0070.05412.72
5.3.250.0100.04812.72
5.3.240.0090.05312.72
5.3.230.0060.05412.71
5.3.220.0110.05012.68
5.3.210.0060.04812.68
5.3.200.0050.04012.68
5.3.190.0120.04012.68
5.3.180.0060.04112.67
5.3.170.0080.03512.67
5.3.160.0090.03412.67
5.3.150.0080.03612.67
5.3.140.0090.03512.66
5.3.130.0050.04112.66
5.3.120.0100.03512.66
5.3.110.0040.04212.66
5.3.100.0060.03712.12
5.3.90.0070.04012.08
5.3.80.0090.03412.07
5.3.70.0060.03612.07
5.3.60.0040.03912.06
5.3.50.0040.03712.00
5.3.40.0070.03512.00
5.3.30.0060.03411.96
5.3.20.0050.03611.74
5.3.10.0080.03511.70
5.3.00.0090.03411.70
5.2.170.0060.0329.20
5.2.160.0080.0279.20
5.2.150.0030.0329.20
5.2.140.0060.0319.20
5.2.130.0050.0299.16
5.2.120.0070.0279.16
5.2.110.0040.0319.17
5.2.100.0080.0269.16
5.2.90.0050.0309.16
5.2.80.0070.0289.16
5.2.70.0060.0299.16
5.2.60.0050.0299.11
5.2.50.0080.0429.08
5.2.40.0080.0359.05
5.2.30.0060.0389.04
5.2.20.0050.0329.02
5.2.10.0050.0278.94
5.2.00.0050.0298.80
5.1.60.0090.0208.09
5.1.50.0070.0218.08
5.1.40.0080.0208.06
5.1.30.0040.0268.41
5.1.20.0050.0268.43
5.1.10.0060.0248.16
5.1.00.0060.0258.16
5.0.50.0040.0216.64
5.0.40.0040.0216.50
5.0.30.0040.0326.31
5.0.20.0060.0206.29
5.0.10.0060.0256.26
5.0.00.0060.0366.25
4.4.90.0050.0194.78
4.4.80.0050.0194.75
4.4.70.0060.0174.76
4.4.60.0040.0194.76
4.4.50.0060.0184.77
4.4.40.0040.0384.71
4.4.30.0010.0244.75
4.4.20.0030.0234.84
4.4.10.0040.0234.85
4.4.00.0040.0334.76
4.3.110.0030.0154.66
4.3.100.0050.0134.67
4.3.90.0040.0134.63
4.3.80.0030.0274.58
4.3.70.0050.0154.63
4.3.60.0040.0184.63
4.3.50.0040.0204.63
4.3.40.0020.0274.54
4.3.30.0000.0193.28
4.3.20.0010.0173.26
4.3.10.0030.0153.22
4.3.00.0070.0237.36

preferences:
37.68 ms | 400 KiB | 5 Q