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-22 16:29:16'); // 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.00719.09
8.3.30.0150.00019.21
8.3.20.0070.00020.35
8.3.10.0000.00822.14
8.3.00.0080.00022.50
8.2.170.0140.00022.96
8.2.160.0080.00620.33
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00017.75
8.2.110.0040.00422.17
8.2.100.0040.00819.88
8.2.90.0030.00619.34
8.2.80.0040.00418.29
8.2.70.0040.00417.74
8.2.60.0040.00418.15
8.2.50.0040.00418.07
8.2.40.0040.00418.28
8.2.30.0000.00718.16
8.2.20.0040.00418.12
8.2.10.0040.00417.88
8.2.00.0040.00418.13
8.1.270.0060.00321.89
8.1.260.0050.00226.35
8.1.250.0060.00328.09
8.1.240.0080.00024.09
8.1.230.0060.00619.14
8.1.220.0000.00817.79
8.1.210.0000.00818.77
8.1.200.0060.00317.46
8.1.190.0050.00217.63
8.1.180.0080.00018.10
8.1.170.0080.00018.71
8.1.160.0000.00722.10
8.1.150.0040.00418.83
8.1.140.0000.00717.78
8.1.130.0000.00717.99
8.1.120.0000.00717.73
8.1.110.0020.00517.74
8.1.100.0000.00717.73
8.1.90.0070.00017.66
8.1.80.0040.00417.78
8.1.70.0000.00717.71
8.1.60.0000.00917.67
8.1.50.0000.00817.70
8.1.40.0040.00417.71
8.1.30.0040.00417.84
8.1.20.0040.00417.86
8.1.10.0000.00917.66
8.1.00.0000.00717.82
8.0.300.0040.00418.77
8.0.290.0000.00817.18
8.0.280.0050.00318.60
8.0.270.0030.00317.29
8.0.260.0000.00718.61
8.0.250.0050.00317.13
8.0.240.0000.00817.25
8.0.230.0000.00717.30
8.0.220.0060.00017.19
8.0.210.0000.00717.17
8.0.200.0000.00717.13
8.0.190.0070.00017.20
8.0.180.0040.00417.19
8.0.170.0000.00817.16
8.0.160.0040.00417.17
8.0.150.0050.00317.03
8.0.140.0070.00017.13
8.0.130.0030.00313.57
8.0.120.0000.00917.02
8.0.110.0040.00417.18
8.0.100.0030.00517.22
8.0.90.0040.00417.11
8.0.80.0070.01017.14
8.0.70.0000.00717.13
8.0.60.0000.00717.24
8.0.50.0000.00817.00
8.0.30.0100.01017.28
8.0.20.0110.00817.43
8.0.10.0040.00417.26
8.0.00.0090.00917.10
7.4.330.0000.00615.29
7.4.320.0060.00016.71
7.4.300.0000.00716.73
7.4.290.0040.00416.84
7.4.280.0000.00816.73
7.4.270.0040.00416.82
7.4.260.0030.00616.79
7.4.250.0040.00416.83
7.4.240.0020.00516.81
7.4.230.0040.00416.56
7.4.220.0100.00716.72
7.4.210.0060.01016.73
7.4.200.0050.00316.47
7.4.190.0040.00416.62
7.4.160.0090.01216.87
7.4.150.0140.01017.40
7.4.140.0150.00617.86
7.4.130.0100.01116.66
7.4.120.0120.00616.85
7.4.110.0100.00716.71
7.4.100.0110.00716.78
7.4.90.0110.00916.80
7.4.80.0130.00919.39
7.4.70.0000.01716.65
7.4.60.0030.01416.66
7.4.50.0080.00016.78
7.4.40.0060.01222.77
7.4.30.0030.01316.56
7.4.00.0080.01115.20
7.3.330.0090.00013.16
7.3.320.0050.00013.31
7.3.310.0060.00016.55
7.3.300.0000.00716.42
7.3.290.0060.01716.48
7.3.280.0090.00816.45
7.3.270.0090.00917.40
7.3.260.0060.01216.64
7.3.250.0070.01116.56
7.3.240.0130.00416.84
7.3.230.0100.01316.60
7.3.210.0150.00716.58
7.3.200.0060.01619.39
7.3.190.0060.01516.63
7.3.180.0080.00816.39
7.3.170.0080.00816.54
7.3.160.0020.01616.66
7.3.120.0120.00615.04
7.3.110.0060.01214.96
7.3.100.0060.01015.27
7.3.90.0160.00315.00
7.3.80.0090.00614.80
7.3.70.0090.01314.93
7.3.60.0120.00815.20
7.3.50.0090.00414.89
7.3.40.0090.00615.08
7.3.30.0150.00014.62
7.3.20.0080.01116.85
7.3.10.0090.00816.63
7.3.00.0090.00916.66
7.2.330.0040.01316.99
7.2.320.0090.00417.04
7.2.310.0100.00616.87
7.2.300.0030.01316.61
7.2.290.0040.01217.09
7.2.250.0090.01415.52
7.2.240.0110.01114.80
7.2.230.0110.00615.23
7.2.220.0030.00714.91
7.2.210.0090.01215.32
7.2.200.0120.00615.09
7.2.190.0060.00915.22
7.2.180.0090.00914.98
7.2.170.0080.01315.01
7.2.130.0170.00817.06
7.2.120.0090.01116.73
7.2.110.0140.00816.98
7.2.100.0120.00416.80
7.2.90.0130.01716.72
7.2.80.0140.01017.00
7.2.70.0220.00616.65
7.2.60.0100.01316.63
7.2.50.0220.00317.14
7.2.40.0110.01517.00
7.2.30.0180.01116.67
7.2.20.0210.00616.66
7.2.10.0270.00417.09
7.2.00.0070.01417.11
7.1.330.0080.01216.08
7.1.320.0130.00315.88
7.1.310.0170.00316.07
7.1.300.0060.00915.83
7.1.290.0080.00815.87
7.1.280.0120.00415.94
7.1.270.0100.01016.11
7.1.260.0150.00016.12
7.1.250.0140.00015.68
7.1.70.0040.00417.41
7.1.60.0110.01519.82
7.1.50.0130.01017.18
7.1.00.0070.07322.44
7.0.200.0070.00716.68
7.0.140.0000.07721.97
7.0.60.0070.07719.95
7.0.50.0030.04017.82
7.0.40.0070.06020.16
7.0.30.0230.05020.09
7.0.20.0430.06320.31
7.0.10.0030.04720.09
7.0.00.0100.09020.30
5.6.210.0030.04020.48
5.6.200.0030.09018.16
5.6.190.0070.04320.61
5.6.180.3630.04020.33
5.6.170.0230.04320.39
5.6.160.0030.06320.48
5.6.150.0170.07318.22
5.6.140.0030.04018.22
5.6.130.0070.08718.14
5.6.120.0170.05320.96
5.6.110.0030.04720.98
5.6.100.0070.08721.01
5.6.90.0100.03721.10
5.6.80.0200.06320.36
5.6.70.3500.03320.50
5.5.350.0170.07720.34
5.5.340.0100.07017.98
5.5.330.0030.07320.14
5.5.320.3500.04720.24
5.5.310.0070.05020.29
5.5.300.0030.06717.92
5.5.290.0130.07017.97
5.5.280.0000.04720.78
5.5.270.0100.05320.88
5.5.260.0030.08020.90
5.5.250.0030.04020.71
5.5.240.0170.07020.16
5.4.450.0100.06319.50
5.4.440.0200.05719.13
5.4.430.0130.05319.50
5.4.420.0200.06719.45
5.4.410.0170.05019.36
5.4.400.0200.06018.76
5.4.390.0030.05718.71
5.4.380.0370.04018.66
5.4.370.0200.04718.73
5.4.360.0170.04718.53
5.4.350.0200.05018.61
5.4.340.0170.05018.65
5.4.320.0070.04112.46
5.4.310.0070.03812.46
5.4.300.0040.03912.46
5.4.290.0070.03812.46
5.4.280.0100.04412.36
5.4.270.0170.04719.16
5.4.260.0130.05018.91
5.4.250.0070.05318.98
5.4.240.0130.08018.79
5.4.230.0170.06019.00
5.4.220.0100.07718.77
5.4.210.0130.05019.16
5.4.200.0100.06018.91
5.4.190.0270.04318.79
5.4.180.0030.05719.05
5.4.170.0130.05019.07
5.4.160.0100.05018.90
5.4.150.0100.07718.90
5.4.140.0100.04716.69
5.4.130.0100.04716.56
5.4.120.0200.06316.55
5.4.110.0100.05016.58
5.4.100.0030.06716.41
5.4.90.0100.04716.64
5.4.80.0100.05016.41
5.4.70.0100.05316.62
5.4.60.0000.05716.38
5.4.50.0030.05716.61
5.4.40.0130.04716.59
5.4.30.0100.04716.37
5.4.20.0070.05316.46
5.4.10.0130.04716.57
5.4.00.0100.05316.00
5.3.290.0070.04112.80
5.3.280.0070.05714.80
5.3.270.0200.04714.73
5.3.260.0270.05714.60
5.3.250.0070.05314.75
5.3.240.0070.05314.60
5.3.230.0070.06314.59
5.3.220.0130.04714.56
5.3.210.0100.05314.66
5.3.200.0030.05714.50
5.3.190.0100.05014.71
5.3.180.0070.05314.68
5.3.170.0230.06314.64
5.3.160.0170.04314.55
5.3.150.0130.04314.71
5.3.140.0170.04714.61
5.3.130.0100.05714.54
5.3.120.0100.05314.48
5.3.110.0130.05714.69
5.3.100.0070.05014.22
5.3.90.0170.04014.01
5.3.80.0070.06314.07
5.3.70.0030.05714.10
5.3.60.0130.06313.99
5.3.50.0100.04714.02
5.3.40.0230.04314.12
5.3.30.0100.04713.91
5.3.20.0170.05013.88
5.3.10.0200.05313.65
5.3.00.0170.04313.72
5.2.170.0000.04711.26
5.2.160.0030.05311.28
5.2.150.0100.04011.29
5.2.140.0030.05011.28
5.2.130.0070.05710.95
5.2.120.0030.04311.16
5.2.110.0070.04011.30
5.2.100.0100.05310.93
5.2.90.0030.06711.04
5.2.80.0130.04711.26
5.2.70.0130.03711.23
5.2.60.0070.04311.17
5.2.50.0030.04311.17
5.2.40.0030.04011.24
5.2.30.0000.05311.14
5.2.20.0070.04010.90
5.2.10.0000.04310.92
5.2.00.0030.04310.72
5.1.60.0130.04010.09
5.1.50.0070.03010.04
5.1.40.0000.04310.07
5.1.30.0070.03310.47
5.1.20.0030.03710.38
5.1.10.0100.03310.27
5.1.00.0030.03710.11
5.0.50.0030.0308.64
5.0.40.0000.0308.73
5.0.30.0070.0408.55
5.0.20.0000.0308.32
5.0.10.0070.0408.47
5.0.00.0100.0378.38
4.4.90.0100.0137.49
4.4.80.0070.0177.49
4.4.70.0000.0277.49
4.4.60.0030.0237.49
4.4.50.0030.0207.49
4.4.40.0100.0307.49
4.4.30.0100.0207.49
4.4.20.0030.0307.46
4.4.10.0070.0177.39
4.4.00.0030.0337.37
4.3.110.0000.0237.33
4.3.100.0030.0237.29
4.3.90.0030.0277.23
4.3.80.0000.0407.17
4.3.70.0030.0277.17
4.3.60.0130.0177.14
4.3.50.0030.0277.00
4.3.40.0030.0337.00
4.3.30.0030.0207.00
4.3.20.0070.0177.00
4.3.10.0000.0277.00
4.3.00.0000.0236.73

preferences:
44.59 ms | 400 KiB | 5 Q