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 11:29:26'); // 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.60.0090.00618.43
8.3.50.0080.00822.19
8.3.40.0000.01418.95
8.3.30.0040.01119.18
8.3.20.0060.00320.34
8.3.10.0040.00421.96
8.3.00.0040.00422.43
8.2.180.0030.01118.42
8.2.170.0100.01022.96
8.2.160.0030.01020.52
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0030.00726.16
8.2.120.0040.00417.71
8.2.110.0000.00922.24
8.2.100.0060.00618.03
8.2.90.0090.00019.47
8.2.80.0080.00018.17
8.2.70.0030.00717.88
8.2.60.0030.00618.05
8.2.50.0000.00818.07
8.2.40.0030.00618.34
8.2.30.0040.00418.27
8.2.20.0000.00718.07
8.2.10.0030.00519.76
8.2.00.0000.00818.01
8.1.280.0060.00825.92
8.1.270.0080.00022.32
8.1.260.0000.00926.35
8.1.250.0080.00028.09
8.1.240.0070.00323.81
8.1.230.0040.00719.29
8.1.220.0050.00317.79
8.1.210.0000.00818.77
8.1.200.0030.00617.60
8.1.190.0040.00417.51
8.1.180.0000.00918.10
8.1.170.0040.00418.80
8.1.160.0000.00722.09
8.1.150.0000.00718.83
8.1.140.0000.00917.72
8.1.130.0050.00317.91
8.1.120.0040.00417.73
8.1.110.0030.00517.63
8.1.100.0000.00717.57
8.1.90.0000.00717.63
8.1.80.0040.00417.74
8.1.70.0070.00017.71
8.1.60.0000.00817.86
8.1.50.0040.00417.72
8.1.40.0040.00417.71
8.1.30.0040.00417.79
8.1.20.0000.00817.93
8.1.10.0000.00817.73
8.1.00.0000.00817.71
8.0.300.0040.00418.77
8.0.290.0070.00017.18
8.0.280.0070.00018.61
8.0.270.0070.00017.35
8.0.260.0000.00617.11
8.0.250.0070.00017.23
8.0.240.0000.00817.26
8.0.230.0030.00317.11
8.0.220.0000.00717.07
8.0.210.0030.00317.24
8.0.200.0070.00017.07
8.0.190.0030.00317.08
8.0.180.0000.00717.09
8.0.170.0040.00417.20
8.0.160.0040.00417.23
8.0.150.0000.00717.18
8.0.140.0000.00717.03
8.0.130.0030.00313.50
8.0.120.0040.00417.14
8.0.110.0060.00317.01
8.0.100.0000.00817.06
8.0.90.0050.00317.24
8.0.80.0150.00017.20
8.0.70.0040.00417.20
8.0.60.0070.00017.21
8.0.50.0000.00717.11
8.0.30.0130.01317.17
8.0.20.0140.00617.40
8.0.10.0040.00417.32
8.0.00.0100.00816.97
7.4.330.0030.00315.00
7.4.320.0030.00316.80
7.4.300.0050.00216.77
7.4.290.0030.00316.79
7.4.280.0040.00416.70
7.4.270.0030.00316.71
7.4.260.0030.00316.66
7.4.250.0000.00716.68
7.4.240.0020.00516.69
7.4.230.0030.00316.55
7.4.220.0110.01516.89
7.4.210.0110.00316.75
7.4.200.0040.00316.68
7.4.190.0040.00416.90
7.4.160.0070.01016.72
7.4.150.0100.01317.40
7.4.140.0100.01017.86
7.4.130.0130.01016.75
7.4.120.0100.00716.77
7.4.110.0130.00316.57
7.4.100.0070.01116.67
7.4.90.0150.00416.68
7.4.80.0100.00719.39
7.4.70.0040.01216.72
7.4.60.0080.00816.61
7.4.50.0060.00316.65
7.4.40.0000.01422.77
7.4.30.0030.01316.88
7.4.00.0100.00714.93
7.3.330.0030.00313.28
7.3.320.0060.00013.29
7.3.310.0070.00016.41
7.3.300.0000.00716.23
7.3.290.0110.00416.40
7.3.280.0050.01216.42
7.3.270.0070.01017.40
7.3.260.0090.00916.59
7.3.250.0100.01116.54
7.3.240.0090.00916.66
7.3.230.0100.00816.54
7.3.210.0030.01416.58
7.3.200.0140.00319.39
7.3.190.0070.01116.87
7.3.180.0040.01216.68
7.3.170.0030.01316.75
7.3.160.0130.00316.68
7.3.120.0060.00915.12
7.3.110.0030.01215.04
7.3.100.0040.01215.07
7.3.90.0070.00715.16
7.3.80.0030.00615.27
7.3.70.0030.00615.17
7.3.60.0090.00614.93
7.3.50.0070.00314.87
7.3.40.0000.01015.05
7.3.30.0060.00614.99
7.3.20.0070.00716.63
7.3.10.0120.00316.77
7.3.00.0040.01116.80
7.2.330.0150.00316.97
7.2.320.0080.01816.56
7.2.310.0160.00316.79
7.2.300.0130.00317.17
7.2.290.0070.01016.65
7.2.250.0130.00715.20
7.2.240.0040.00815.42
7.2.230.0030.01015.48
7.2.220.0110.00415.12
7.2.210.0030.01115.49
7.2.200.0000.01415.41
7.2.190.0090.00915.07
7.2.180.0080.00715.08
7.2.170.0070.00715.23
7.2.160.0110.00715.40
7.2.150.0070.00317.02
7.2.140.0100.00616.91
7.2.130.0070.00716.96
7.2.120.0030.01116.83
7.2.110.0070.00716.78
7.2.100.0030.01217.13
7.2.90.0030.01017.09
7.2.80.0070.01017.03
7.2.70.0070.01117.20
7.2.60.0040.00717.28
7.2.50.0070.00717.04
7.2.40.0110.00717.26
7.2.30.0070.01017.17
7.2.20.0060.01017.09
7.2.10.0090.00617.21
7.2.00.0060.01018.41
7.1.330.0030.01216.07
7.1.320.0000.01315.96
7.1.310.0080.00016.20
7.1.300.0100.00715.86
7.1.290.0000.01315.89
7.1.280.0070.00415.97
7.1.270.0030.01416.07
7.1.260.0060.00316.08
7.1.250.0000.01515.97
7.1.240.0070.00315.71
7.1.230.0030.00915.90
7.1.220.0070.01015.98
7.1.210.0030.00715.82
7.1.200.0160.00015.82
7.1.190.0100.00615.73
7.1.180.0110.00015.92
7.1.170.0030.00716.17
7.1.160.0060.01015.89
7.1.150.0090.00615.80
7.1.140.0000.01215.84
7.1.130.0110.00315.66
7.1.120.0060.00615.67
7.1.110.0090.00315.97
7.1.100.0020.01117.26
7.1.90.0000.00916.12
7.1.80.0000.00915.75
7.1.70.0060.00416.61
7.1.60.0100.00917.86
7.1.50.0140.00616.54
7.1.40.0030.01415.95
7.1.30.0000.01715.78
7.1.20.0000.01116.07
7.1.10.0030.01016.01
7.1.00.0060.04219.14
7.0.330.0040.00915.29
7.0.320.0060.00615.27
7.0.310.0000.00814.93
7.0.300.0060.00615.70
7.0.290.0150.00315.54
7.0.280.0090.00615.58
7.0.270.0040.01215.59
7.0.260.0060.00615.57
7.0.250.0060.00615.70
7.0.240.0030.00515.71
7.0.230.0030.00915.68
7.0.220.0030.01015.81
7.0.210.0060.00315.66
7.0.200.0060.00916.22
7.0.190.0030.01315.70
7.0.180.0000.01615.62
7.0.170.0060.00815.59
7.0.160.0040.00815.39
7.0.150.0110.00715.48
7.0.140.0080.03918.76
7.0.130.0080.00615.47
7.0.120.0070.00715.39
7.0.110.0040.01215.41
7.0.100.0040.01115.32
7.0.90.0090.00015.53
7.0.80.0040.01115.61
7.0.70.0090.00015.34
7.0.60.0070.04517.70
7.0.50.0000.05016.71
7.0.40.0090.03217.11
7.0.30.0130.02816.84
7.0.20.0150.02816.90
7.0.10.0030.03116.81
7.0.00.0060.02616.67
5.6.400.0000.01414.56
5.6.390.0030.01014.75
5.6.380.0100.00714.72
5.6.370.0070.00314.79
5.6.360.0000.00914.62
5.6.350.0100.01014.22
5.6.340.0000.01114.71
5.6.330.0090.00614.72
5.6.320.0030.00614.77
5.6.310.0030.01014.37
5.6.300.0070.01114.48
5.6.290.0030.01514.62
5.6.280.0060.04117.79
5.6.270.0030.01314.29
5.6.260.0070.00714.62
5.6.250.0060.00914.65
5.6.240.0110.00414.56
5.6.230.0090.00614.45
5.6.220.0040.00814.52
5.6.210.0030.02517.66
5.6.200.0050.04216.38
5.6.190.0070.04817.33
5.6.180.1650.02617.54
5.6.170.0170.04117.30
5.6.160.0030.03517.55
5.6.150.0070.02816.52
5.6.140.0030.02816.44
5.6.130.0050.04516.27
5.6.120.0040.05017.69
5.6.110.0070.04417.77
5.6.100.0080.04217.76
5.6.90.0080.03017.73
5.6.80.0080.03817.42
5.6.70.2160.02117.54
5.6.60.0100.00314.69
5.6.50.0100.00714.61
5.6.40.0000.01314.40
5.6.30.0030.01314.42
5.6.20.0040.00714.12
5.6.10.0100.00314.41
5.6.00.0040.01414.45
5.5.380.0110.00014.55
5.5.370.0060.00614.38
5.5.360.0030.01214.33
5.5.350.0160.03817.38
5.5.340.0070.02516.24
5.5.330.0040.02417.42
5.5.320.1900.01817.32
5.5.310.0100.02317.43
5.5.300.0080.03816.24
5.5.290.0100.02716.26
5.5.280.0070.04317.55
5.5.270.0080.02017.67
5.5.260.0050.04917.63
5.5.250.0050.03817.52
5.5.240.0190.03617.26
5.5.230.0060.00314.03
5.5.220.0030.01014.57
5.5.210.0080.00414.44
5.5.200.0140.00414.22
5.5.190.0100.00714.27
5.5.180.0070.00414.10
5.5.170.0000.01214.07
5.5.160.0080.00614.28
5.5.150.0040.00414.11
5.5.140.0040.00714.36
5.5.130.0000.01314.55
5.5.120.0060.00614.44
5.5.110.0060.01014.61
5.5.100.0090.00614.31
5.5.90.0090.00614.43
5.5.80.0030.01014.64
5.5.70.0060.00314.45
5.5.60.0050.00514.30
5.5.50.0000.01614.41
5.5.40.0090.00614.21
5.5.30.0080.00814.31
5.5.20.0040.00714.54
5.5.10.0040.01214.56
5.5.00.0060.00614.16
5.4.450.0370.02815.80
5.4.440.0320.03115.88
5.4.430.0050.04315.98
5.4.420.0050.03615.95
5.4.410.0030.03315.85
5.4.400.0130.02315.49
5.4.390.0100.02815.49
5.4.380.0120.03415.58
5.4.370.0030.03315.61
5.4.360.0100.03015.61
5.4.350.0130.02815.56
5.4.340.0100.02715.53
5.4.330.0090.00312.45
5.4.320.0040.02312.46
5.4.310.0080.02212.45
5.4.300.0090.02412.46
5.4.290.0050.02012.45
5.4.280.0040.02112.40
5.4.270.0070.03815.69
5.4.260.0050.02815.72
5.4.250.0050.02815.72
5.4.240.0150.03015.68
5.4.230.0090.04015.68
5.4.220.0030.04715.61
5.4.210.0060.04115.69
5.4.200.0100.02515.59
5.4.190.0030.03315.71
5.4.180.0030.03115.67
5.4.170.0030.03115.65
5.4.160.0070.03015.60
5.4.150.0080.04015.66
5.4.140.0100.02514.41
5.4.130.0080.03514.48
5.4.120.0080.02714.46
5.4.110.0030.03614.50
5.4.100.0070.02614.42
5.4.90.0040.03214.52
5.4.80.0050.04114.41
5.4.70.0060.03114.50
5.4.60.0070.03314.53
5.4.50.0120.02514.45
5.4.40.0070.02814.49
5.4.30.0040.02914.50
5.4.20.0100.02614.47
5.4.10.0030.03314.52
5.4.00.0030.03314.22
5.3.290.0070.02212.63
5.3.280.0080.02813.52
5.3.270.0080.02513.58
5.3.260.0100.03313.44
5.3.250.0070.02713.56
5.3.240.0110.02313.60
5.3.230.0100.02513.61
5.3.220.0050.03313.47
5.3.210.0080.03013.51
5.3.200.0020.03913.58
5.3.190.0080.02613.41
5.3.180.0090.02413.53
5.3.170.0100.03813.57
5.3.160.0030.03013.58
5.3.150.0060.02813.54
5.3.140.0020.03213.60
5.3.130.0100.03813.46
5.3.120.0030.03513.41
5.3.110.0060.03313.41
5.3.100.0100.02313.29
5.3.90.0030.03113.14
5.3.80.0120.02213.32
5.3.70.0030.02813.29
5.3.60.0110.03313.21
5.3.50.0050.03613.23
5.3.40.0050.02813.25
5.3.30.0070.02513.26
5.3.20.0100.02513.17
5.3.10.0020.03213.14
5.3.00.0030.03013.07
5.2.170.0130.04011.40
5.2.160.0070.04711.31
5.2.150.0070.04011.29
5.2.140.0000.05311.36
5.2.130.0030.04310.93
5.2.120.0170.03311.23
5.2.110.0070.05311.16
5.2.100.0070.04711.30
5.2.90.0000.04311.25
5.2.80.0100.03710.89
5.2.70.0070.04311.26
5.2.60.0100.05711.13
5.2.50.0000.06011.02
5.2.40.0100.05310.94
5.2.30.0030.04311.11
5.2.20.0030.04310.81
5.2.10.0130.03711.15
5.2.00.0070.05310.61
5.1.60.0030.03310.30
5.1.50.0030.0379.98
5.1.40.0100.04710.18
5.1.30.0070.03310.62
5.1.20.0100.05010.66
5.1.10.0070.04710.16
5.1.00.0100.04010.37
5.0.50.0130.0308.61
5.0.40.0100.0208.51
5.0.30.0000.0438.43
5.0.20.0030.0308.35
5.0.10.0070.0238.23
5.0.00.0030.0408.38
4.4.90.0030.0277.49
4.4.80.0030.0207.49
4.4.70.0000.0237.49
4.4.60.0030.0207.49
4.4.50.0030.0207.49
4.4.40.0100.0377.49
4.4.30.0000.0237.49
4.4.20.0000.0237.49
4.4.10.0000.0237.49
4.4.00.0000.0377.49
4.3.110.0000.0237.49
4.3.100.0100.0137.49
4.3.90.0000.0237.49
4.3.80.0030.0337.49
4.3.70.0030.0207.49
4.3.60.0030.0207.49
4.3.50.0030.0207.49
4.3.40.0070.0437.49
4.3.30.0070.0207.49
4.3.20.0000.0237.49
4.3.10.0030.0237.49
4.3.00.0070.0276.73

preferences:
47.34 ms | 401 KiB | 5 Q