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 * 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.0110.00416.88
8.3.50.0130.00822.19
8.3.40.0180.00319.22
8.3.30.0080.00619.17
8.3.20.0040.00420.34
8.3.10.0000.00823.63
8.3.00.0070.00019.02
8.2.180.0110.00416.75
8.2.170.0040.01222.96
8.2.160.0120.00320.56
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0080.00020.79
8.2.110.0060.00321.17
8.2.100.0110.00018.09
8.2.90.0040.00419.53
8.2.80.0030.00517.97
8.2.70.0040.00417.75
8.2.60.0080.00018.05
8.2.50.0030.00518.07
8.2.40.0000.00821.19
8.2.30.0000.00718.35
8.2.20.0050.00317.95
8.2.10.0040.00418.27
8.2.00.0040.00418.01
8.1.280.0110.00325.92
8.1.270.0000.00823.87
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0060.00322.33
8.1.230.0120.00018.92
8.1.220.0040.00417.89
8.1.210.0000.00818.77
8.1.200.0080.00017.60
8.1.190.0040.00417.48
8.1.180.0080.00018.10
8.1.170.0050.00518.76
8.1.160.0040.00422.15
8.1.150.0040.00418.84
8.1.140.0030.00517.79
8.1.130.0000.00717.90
8.1.120.0050.00217.70
8.1.110.0040.00417.75
8.1.100.0050.00317.80
8.1.90.0040.00417.63
8.1.80.0070.00017.73
8.1.70.0000.00717.71
8.1.60.0000.00817.68
8.1.50.0030.00617.68
8.1.40.0080.00017.62
8.1.30.0040.00417.89
8.1.20.0030.00617.81
8.1.10.0030.00517.67
8.1.00.0040.00417.68
8.0.300.0000.00820.13
8.0.290.0070.00017.00
8.0.280.0070.00018.64
8.0.270.0030.00517.42
8.0.260.0040.00417.33
8.0.250.0000.00817.20
8.0.240.0050.00217.28
8.0.230.0000.00717.22
8.0.220.0000.00717.14
8.0.210.0080.00017.20
8.0.200.0080.00017.13
8.0.190.0070.00017.23
8.0.180.0080.00017.08
8.0.170.0070.00017.16
8.0.160.0000.00717.08
8.0.150.0030.00617.02
8.0.140.0040.00317.04
8.0.130.0000.00613.50
8.0.120.0040.00417.12
8.0.110.0040.00417.04
8.0.100.0000.00717.07
8.0.90.0030.00517.15
8.0.80.0000.01617.23
8.0.70.0040.00417.04
8.0.60.0000.00817.21
8.0.50.0070.00017.23
8.0.30.0060.01317.47
8.0.20.0110.00817.60
8.0.10.0000.00717.41
8.0.00.0100.00817.14
7.4.330.0000.00615.23
7.4.320.0030.00316.78
7.4.300.0040.00416.86
7.4.290.0030.00316.58
7.4.280.0060.00316.86
7.4.270.0050.00316.83
7.4.260.0050.00516.70
7.4.250.0040.00416.81
7.4.240.0070.00016.72
7.4.230.0040.00416.66
7.4.220.0030.01416.74
7.4.210.0040.01016.89
7.4.200.0030.00316.56
7.4.190.0040.00416.84
7.4.160.0060.01016.75
7.4.150.0140.00317.40
7.4.140.0130.00517.86
7.4.130.0090.00916.86
7.4.120.0140.00616.79
7.4.110.0090.00916.91
7.4.100.0120.00916.73
7.4.90.0060.01216.63
7.4.80.0070.01119.39
7.4.70.0120.00616.83
7.4.60.0030.01416.73
7.4.50.0000.00416.86
7.4.40.0080.00816.62
7.4.30.0090.00616.86
7.4.00.0070.00715.06
7.3.330.0000.00613.35
7.3.320.0030.00313.33
7.3.310.0050.00216.42
7.3.300.0000.00716.43
7.3.290.0030.01216.44
7.3.280.0070.01416.47
7.3.270.0150.00417.40
7.3.260.0140.00916.77
7.3.250.0120.00916.65
7.3.240.0150.00316.35
7.3.230.0100.00716.67
7.3.210.0100.00716.54
7.3.200.0090.01219.39
7.3.190.0070.01116.88
7.3.180.0120.00316.76
7.3.170.0060.01116.88
7.3.160.0090.00616.59
7.3.120.0120.00315.23
7.2.330.0140.00316.65
7.2.320.0140.00416.73
7.2.310.0070.01016.81
7.2.300.0120.00917.10
7.2.290.0120.00917.06
7.2.60.0000.01217.24
7.2.00.0040.01119.79
7.1.200.0040.00815.78
7.1.100.0000.01118.63
7.1.70.0050.00517.18
7.1.60.0100.01319.46
7.1.50.0040.00817.39
7.1.00.0000.07722.37
7.0.200.0050.00317.01
7.0.140.0030.07321.95
7.0.60.0100.05719.91
7.0.50.0070.06317.80
7.0.40.0100.08319.90
7.0.30.0170.04320.09
7.0.20.0170.08320.30
7.0.10.0030.05020.04
7.0.00.0070.08320.18
5.6.280.0070.06720.78
5.6.210.0100.04720.47
5.6.200.0030.07318.22
5.6.190.0070.04020.42
5.6.180.0200.07320.36
5.6.170.0200.03720.42
5.6.160.0000.09320.43
5.6.150.0030.05018.15
5.6.140.0070.03718.22
5.6.130.0000.04318.11
5.6.120.0000.06720.88
5.6.110.0130.04721.00
5.6.100.0100.08021.00
5.6.90.0270.05721.07
5.6.80.0030.04020.54
5.5.350.0130.03720.47
5.5.340.0130.03317.98
5.5.330.0070.08320.57
5.5.320.0370.07720.21
5.5.310.0130.04720.29
5.5.300.0030.07017.95
5.5.290.0100.08017.92
5.5.280.0130.07720.78
5.5.270.0000.04320.98
5.5.260.0030.07720.77
5.5.250.0100.04320.55
5.5.240.0070.06020.19
5.4.450.0570.06019.24
5.4.440.0900.05019.63
5.4.430.1100.05319.17
5.4.420.1130.06019.61
5.4.410.0830.06319.41
5.4.400.1070.05319.35
5.4.390.1130.07719.17
5.4.380.0270.05718.70
5.4.370.0470.05318.51
5.4.360.0330.07718.77
5.4.350.0300.06018.48
5.4.340.0470.06018.63
5.4.320.0080.05012.46
5.4.310.0050.03912.46
5.4.300.0060.05112.46
5.4.290.0090.04712.46
5.4.280.0090.04912.36
5.4.270.0110.07512.36
5.4.260.0140.07112.36
5.4.250.0120.07012.36
5.4.240.0110.06712.36
5.4.230.0080.07212.35
5.4.220.0080.05012.35
5.4.210.0090.05112.35
5.4.200.0130.07812.35
5.4.190.0080.13512.34
5.4.180.0080.05812.35
5.4.170.0080.05412.36
5.4.160.0160.06512.36
5.4.150.0110.06112.35
5.4.140.0110.04912.04
5.4.130.0090.04712.02
5.4.120.0120.05111.98
5.4.110.0080.05611.97
5.4.100.0090.05111.97
5.4.90.0080.05511.97
5.4.80.0120.04811.97
5.4.70.0070.05111.97
5.4.60.0100.05311.97
5.4.50.0110.05411.98
5.4.40.0110.06011.96
5.4.30.0110.05711.96
5.4.20.0220.10911.95
5.4.10.0190.08711.96
5.4.00.0310.10411.45
5.3.290.0060.04312.80
5.3.280.0090.06412.71
5.3.270.0210.10912.73
5.3.260.0300.12712.72
5.3.250.0090.05312.72
5.3.240.0090.05312.72
5.3.230.0120.04812.71
5.3.220.0070.06012.68
5.3.210.0060.06112.68
5.3.200.0160.09612.68
5.3.190.0240.09912.68
5.3.180.0130.06912.68
5.3.170.0060.05712.67
5.3.160.0070.06712.68
5.3.150.0150.06712.67
5.3.140.0200.08412.66
5.3.130.0210.07912.66
5.3.120.0080.05612.66
5.3.110.0090.05112.66
5.3.100.0090.05012.12
5.3.90.0120.04712.08
5.3.80.0100.04712.07
5.3.70.0120.04412.08
5.3.60.0120.06212.07
5.3.50.0190.09212.00
5.3.40.0120.08012.00
5.3.30.0180.07611.96
5.3.20.0120.07011.74
5.3.10.0120.09811.70
5.3.00.0100.04711.69
5.2.170.0070.0419.20
5.2.160.0110.0639.20
5.2.150.0120.0939.20
5.2.140.0080.0419.20
5.2.130.0090.0559.16
5.2.120.0100.0679.16
5.2.110.0180.0639.16
5.2.100.0110.0609.16
5.2.90.0170.0659.16
5.2.80.0170.0609.16
5.2.70.0170.0469.16
5.2.60.0150.0449.11
5.2.50.0080.0759.08
5.2.40.0210.0729.06
5.2.30.0130.0929.04
5.2.20.0190.0709.02
5.2.10.0200.0868.95
5.2.00.0140.0718.80
5.1.60.0100.0928.08
5.1.50.0090.0468.08
5.1.40.0090.0418.06
5.1.30.0220.1098.41
5.1.20.0110.0358.43
5.1.10.0150.0468.16
5.1.00.0080.0518.16
5.0.50.0060.0286.64
5.0.40.0040.0316.50
5.0.30.0030.0476.31
5.0.20.0100.0576.28
5.0.10.0120.0666.26
5.0.00.0060.0416.25
4.4.90.0080.0434.78
4.4.80.0030.0524.76
4.4.70.0140.0494.76
4.4.60.0090.0344.75
4.4.50.0070.0334.77
4.4.40.0020.0364.71
4.4.30.0050.0214.76
4.4.20.0070.0204.84
4.4.10.0050.0224.85
4.4.00.0070.0324.76
4.3.110.0070.0204.67
4.3.100.0090.0174.66
4.3.90.0080.0234.63
4.3.80.0100.0624.59
4.3.70.0060.0294.63
4.3.60.0050.0194.63
4.3.50.0070.0184.63
4.3.40.0040.0334.54
4.3.30.0020.0223.29
4.3.20.0070.0173.26
4.3.10.0020.0233.22
4.3.00.0000.0237.36

preferences:
42.63 ms | 401 KiB | 5 Q