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-24 03:58:58'); // 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; echo $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.0150.00018.55
8.3.50.0100.01022.05
8.3.40.0000.01418.92
8.3.30.0110.00719.34
8.3.20.0030.00620.20
8.3.10.0050.00323.70
8.3.00.0120.00918.85
8.2.180.0130.00318.56
8.2.170.0030.01122.96
8.2.160.0130.00722.31
8.2.150.0030.01324.18
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0020.00521.00
8.2.110.0100.00020.98
8.2.100.0080.00418.16
8.2.90.0000.00818.15
8.2.80.0000.00817.97
8.2.70.0060.00317.75
8.2.60.0060.00318.05
8.2.50.0060.00318.07
8.2.40.0080.00018.41
8.2.30.0000.00718.27
8.2.20.0040.00418.02
8.2.10.0030.00618.29
8.2.00.0080.00017.90
8.1.280.0100.01025.92
8.1.270.0030.00618.98
8.1.260.0050.00326.35
8.1.250.0050.00228.09
8.1.240.0060.00322.79
8.1.230.0040.00720.93
8.1.220.0050.00317.74
8.1.210.0000.00918.97
8.1.200.0070.00317.48
8.1.190.0000.00817.25
8.1.180.0030.00618.10
8.1.170.0000.00818.55
8.1.160.0060.00322.16
8.1.150.0040.00419.08
8.1.140.0060.00319.55
8.1.130.0070.00017.89
8.1.120.0000.00717.81
8.1.110.0040.00417.61
8.1.100.0000.00717.61
8.1.90.0040.00417.66
8.1.80.0050.00217.63
8.1.70.0000.00717.80
8.1.60.0040.00417.79
8.1.50.0040.00417.71
8.1.40.0000.00717.79
8.1.30.0030.00517.80
8.1.20.0040.00417.77
8.1.10.0000.00917.72
8.1.00.0080.00017.64
8.0.300.0040.00420.04
8.0.290.0040.00416.88
8.0.280.0070.00018.51
8.0.270.0040.00417.42
8.0.260.0000.00617.41
8.0.250.0040.00417.13
8.0.240.0000.00817.19
8.0.230.0040.00417.25
8.0.220.0030.00317.19
8.0.210.0040.00417.08
8.0.200.0050.00317.25
8.0.190.0060.00317.26
8.0.180.0050.00317.22
8.0.170.0000.00817.25
8.0.160.0000.00717.08
8.0.150.0000.00817.15
8.0.140.0000.00717.13
8.0.130.0030.00313.54
8.0.120.0000.00817.16
8.0.110.0040.00417.08
8.0.100.0000.00717.02
8.0.90.0070.00017.27
8.0.80.0070.01717.12
8.0.70.0000.00817.00
8.0.60.0040.00417.16
8.0.50.0040.00417.04
8.0.30.0100.01017.46
8.0.20.0130.00817.40
8.0.10.0070.00017.24
8.0.00.0090.00917.04
7.4.330.0000.00515.21
7.4.320.0050.00216.73
7.4.300.0050.00316.73
7.4.290.0000.00716.74
7.4.280.0070.00016.80
7.4.270.0030.00316.73
7.4.260.0040.00416.71
7.4.250.0030.00516.80
7.4.240.0020.00516.70
7.4.230.0030.00316.70
7.4.220.0110.00816.84
7.4.210.0040.01116.80
7.4.200.0030.00316.66
7.4.160.0080.00816.81
7.4.150.0140.00417.40
7.4.140.0100.00817.86
7.4.130.0080.01016.81
7.4.120.0090.01116.74
7.4.110.0090.00916.79
7.4.100.0060.01216.69
7.4.90.0120.00916.76
7.4.80.0090.01219.39
7.4.70.0090.00916.57
7.4.60.0040.01216.70
7.4.50.0050.00316.75
7.4.40.0110.01116.58
7.4.30.0100.01016.69
7.4.10.0100.00915.26
7.4.00.0000.01615.26
7.3.330.0030.00413.29
7.3.320.0000.00513.42
7.3.310.0070.00016.38
7.3.300.0000.00716.39
7.3.290.0050.00816.48
7.3.280.0110.00716.48
7.3.270.0070.01017.40
7.3.260.0100.00716.80
7.3.250.0170.00716.67
7.3.240.0030.01416.89
7.3.230.0080.00816.73
7.3.210.0120.00616.58
7.3.200.0110.00519.39
7.3.190.0070.01016.56
7.3.180.0060.01016.83
7.3.170.0170.00916.66
7.3.160.0030.01516.81
7.3.130.0060.01315.15
7.3.120.0080.01015.09
7.3.110.0090.01015.05
7.3.100.0030.01115.08
7.3.90.0020.01015.02
7.3.80.0060.00715.23
7.3.70.0120.00314.86
7.3.60.0070.00715.18
7.3.50.0040.00615.18
7.3.40.0020.01115.07
7.3.30.0070.00714.98
7.3.20.0070.00516.75
7.3.10.0060.00816.81
7.3.00.0060.00916.98
7.2.330.0070.01116.87
7.2.320.0090.00917.01
7.2.310.0130.00616.88
7.2.300.0090.01316.68
7.2.290.0150.00816.64
7.2.260.0080.01215.22
7.2.250.0140.00615.42
7.2.240.0080.00615.40
7.2.230.0070.01115.36
7.2.220.0090.00515.18
7.2.210.0040.01015.28
7.2.200.0050.01015.34
7.2.190.0080.00515.29
7.2.180.0020.01215.28
7.2.170.0080.00515.40
7.2.160.0040.01015.41
7.2.150.0060.01017.02
7.2.140.0050.01117.11
7.2.130.0030.01217.35
7.2.120.0060.01017.24
7.2.110.0080.01017.26
7.2.100.0020.01317.11
7.2.90.0060.00717.18
7.2.80.0080.00817.22
7.2.70.0040.01117.20
7.2.60.0250.00616.71
7.2.50.0050.01017.23
7.2.40.0060.00917.20
7.2.30.0050.00817.27
7.2.20.0100.00317.11
7.2.10.0080.00817.11
7.2.00.0040.00817.75
7.1.330.0040.01016.05
7.1.320.0070.00516.08
7.1.310.0040.01216.11
7.1.300.0080.00516.01
7.1.290.0040.00915.98
7.1.280.0050.00615.97
7.1.270.0070.00516.04
7.1.260.0040.00915.93
7.1.250.0060.00616.01
7.1.240.0060.00716.09
7.1.230.0020.01316.18
7.1.220.0070.00515.91
7.1.210.0080.00515.96
7.1.200.0060.00715.86
7.1.190.0050.00515.98
7.1.180.0040.00916.04
7.1.170.0070.00615.84
7.1.160.0060.00616.03
7.1.150.0060.00616.14
7.1.140.0070.00715.96
7.1.130.0020.00916.03
7.1.120.0040.01015.88
7.1.110.0060.00816.06
7.1.100.0050.00516.73
7.1.90.0060.00515.94
7.1.80.0060.00716.02
7.1.70.0050.00616.55
7.1.60.0060.01017.18
7.1.50.0040.01216.48
7.1.40.0070.00816.13
7.1.30.0050.01115.99
7.1.20.0030.00916.17
7.1.10.0110.00216.01
7.1.00.0050.02918.10
7.0.330.0030.00815.53
7.0.320.0060.00515.58
7.0.310.0020.01415.62
7.0.300.0050.00515.35
7.0.290.0030.00715.69
7.0.280.0050.00715.59
7.0.270.0020.01115.57
7.0.260.0050.00715.60
7.0.250.0040.00715.72
7.0.240.0050.00515.67
7.0.230.0060.00815.60
7.0.220.0030.00915.49
7.0.210.0070.00515.52
7.0.200.0050.00616.02
7.0.190.0020.00715.48
7.0.180.0060.00615.47
7.0.170.0090.00515.57
7.0.160.0050.00515.55
7.0.150.0080.00515.50
7.0.140.0070.02017.74
7.0.130.0090.00315.66
7.0.120.0030.01115.71
7.0.110.0110.00515.66
7.0.100.0060.00815.53
7.0.90.0080.00215.68
7.0.80.0080.00515.56
7.0.70.0100.00415.63
7.0.60.0030.02816.91
7.0.50.0080.03016.29
7.0.40.0050.02015.82
7.0.30.0100.02415.78
7.0.20.0080.02115.74
7.0.10.0040.03415.82
7.0.00.0030.03915.64
5.6.400.0060.01014.45
5.6.390.0020.00814.41
5.6.380.0030.00814.68
5.6.370.0080.00514.48
5.6.360.0060.00414.46
5.6.350.0020.01014.64
5.6.340.0050.00714.73
5.6.330.0060.00514.71
5.6.320.0030.01114.67
5.6.310.0030.00814.34
5.6.300.0080.00714.69
5.6.290.0050.00614.27
5.6.280.0060.02816.71
5.6.270.0050.01114.65
5.6.260.0080.00714.54
5.6.250.0080.00314.48
5.6.240.0040.00914.69
5.6.230.0080.00514.53
5.6.220.0090.00514.48
5.6.210.0050.03016.61
5.6.200.0050.01915.62
5.6.190.0040.02016.52
5.6.180.0120.01816.48
5.6.170.0120.01716.59
5.6.160.0070.03316.58
5.6.150.0070.03215.80
5.6.140.0080.01715.70
5.6.130.0040.03515.81
5.6.120.0050.02116.72
5.6.110.0100.03116.67
5.6.100.0070.02916.69
5.6.90.0110.02816.58
5.6.80.0080.03016.45
5.6.70.0100.00114.49
5.6.60.0080.00514.61
5.6.50.0080.00714.50
5.6.40.0080.00514.70
5.6.30.0020.01314.58
5.6.20.0080.00614.50
5.6.10.0100.00714.45
5.6.00.0060.00614.40
5.5.380.0050.00814.37
5.5.370.0040.00714.26
5.5.360.0050.00514.64
5.5.350.0040.03616.36
5.5.340.0060.03615.63
5.5.330.0020.03016.34
5.5.320.0150.02216.46
5.5.310.0080.02316.46
5.5.300.0070.03115.60
5.5.290.0040.03615.75
5.5.280.0080.02616.42
5.5.270.0040.03116.58
5.5.260.0040.02016.77
5.5.250.0060.03216.52
5.5.240.1320.01416.39
5.5.230.0000.01414.52
5.5.220.0000.01114.34
5.5.210.0040.01114.41
5.5.200.0020.01414.33
5.5.190.0080.00914.32
5.5.180.0080.00514.61
5.5.170.0030.00914.41
5.5.160.0070.00814.51
5.5.150.0060.00714.40
5.5.140.0050.01114.48
5.5.130.0110.00514.53
5.5.120.0080.00414.22
5.5.110.0080.00714.50
5.5.100.0110.00514.47
5.5.90.0020.01014.50
5.5.80.0090.00514.43
5.5.70.0010.01014.40
5.5.60.0070.00814.29
5.5.50.0040.00714.46
5.5.40.0030.01014.54
5.5.30.0070.00514.37
5.5.20.0040.01114.54
5.5.10.0090.00614.30
5.5.00.0040.01114.32
5.4.450.0050.02614.46
5.4.440.0280.02214.54
5.4.430.0080.02014.34
5.4.420.0090.01914.35
5.4.410.0070.02214.38
5.4.400.0090.02014.30
5.4.390.0080.02114.05
5.4.380.0130.02014.10
5.4.370.0100.02014.15
5.4.360.0070.02514.20
5.4.350.0150.01714.14
5.4.340.0130.01514.17
5.4.330.0050.00611.93
5.4.320.0110.02214.23
5.4.310.0130.01814.09
5.4.300.0080.02314.12
5.4.290.0080.02114.13
5.4.280.0070.02414.18
5.4.270.0140.02314.12
5.4.260.0140.02214.07
5.4.250.0080.02414.22
5.4.240.0050.02414.16
5.4.230.0050.02514.04
5.4.220.0130.01914.12
5.4.210.0130.01814.11
5.4.200.0100.02113.39
5.4.190.0080.02014.15
5.4.180.0100.02314.20
5.4.170.0060.02314.04
5.4.160.0090.02014.05
5.4.150.0100.01814.11
5.4.140.0070.02113.36
5.4.130.0060.02413.37
5.4.120.0090.01913.36
5.4.110.0060.02113.25
5.4.100.0080.02213.39
5.4.90.0050.02513.30
5.4.80.0100.02413.38
5.4.70.0110.02013.36
5.4.60.0070.02413.25
5.4.50.0070.02313.31
5.4.40.0110.01913.22
5.4.30.0080.02113.36
5.4.20.0070.02613.29
5.4.10.0070.02213.44
5.4.00.0120.01713.17
5.3.290.0170.05314.66
5.3.280.0270.04014.52
5.3.270.0200.05014.67
5.3.260.0170.05014.61
5.3.250.0200.05014.53
5.3.240.0270.04714.55
5.3.230.0200.04714.60
5.3.220.0170.05014.56
5.3.210.0200.06014.54
5.3.200.0230.04714.67
5.3.190.0070.05714.59
5.3.180.0170.05014.50
5.3.170.0230.04314.55
5.3.160.0130.05014.50
5.3.150.0130.06014.58
5.3.140.0170.04714.67
5.3.130.0200.05014.57
5.3.120.0100.06014.49
5.3.110.0100.05714.55
5.3.100.0070.05713.96
5.3.90.0170.05014.00
5.3.80.0130.05313.93
5.3.70.0100.05314.11
5.3.60.0130.04713.99
5.3.50.0100.05313.88
5.3.40.0230.04713.91
5.3.30.0130.04713.90
5.3.20.0130.04713.67
5.3.10.0300.03313.70
5.3.00.0070.05713.75
5.2.170.0030.05011.31
5.2.160.0070.04311.21
5.2.150.0100.04311.22
5.2.140.0100.04711.31
5.2.130.0170.04011.10
5.2.120.0130.03711.11
5.2.110.0030.04711.09
5.2.100.0070.04311.17
5.2.90.0130.04011.26
5.2.80.0130.04011.04
5.2.70.0100.04711.15
5.2.60.0230.03011.22
5.2.50.0100.04311.04
5.2.40.0070.04310.93
5.2.30.0070.04310.97
5.2.20.0030.04710.89
5.2.10.0070.04310.97
5.2.00.0030.04710.72
5.1.60.0070.03710.07
5.1.50.0030.04310.06
5.1.40.0100.03310.09
5.1.30.0100.03310.45
5.1.20.0000.04710.41
5.1.10.0070.03710.16
5.1.00.0100.03310.11
5.0.50.0030.0308.66
5.0.40.0000.0338.48
5.0.30.0030.0478.26
5.0.20.0100.0238.20
5.0.10.0030.0308.27
5.0.00.0130.0378.26
4.4.90.0070.0235.89
4.4.80.0030.0235.89
4.4.70.0030.0235.86
4.4.60.0100.0175.87
4.4.50.0000.0275.88
4.4.40.0070.0335.89
4.4.30.0070.0205.90
4.4.20.0070.0205.93
4.4.10.0030.0235.96
4.4.00.0100.0305.95
4.3.110.0070.0235.83
4.3.100.0030.0235.84
4.3.90.0070.0205.77
4.3.80.0070.0305.84
4.3.70.0070.0205.82
4.3.60.0070.0205.88
4.3.50.0070.0205.79
4.3.40.0030.0375.78
4.3.30.0100.0174.66
4.3.20.0030.0204.54
4.3.10.0030.0204.50
4.3.00.0000.0238.31

preferences:
43.34 ms | 401 KiB | 5 Q