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 $hours; // 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.0040.01118.42
8.3.50.0120.00922.11
8.3.40.0040.01118.92
8.3.30.0130.00719.35
8.3.20.0120.00620.04
8.3.10.0040.00423.70
8.3.00.0090.00019.08
8.2.180.0000.01518.79
8.2.170.0070.00722.96
8.2.160.0130.00322.03
8.2.150.0120.00324.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0070.00717.79
8.2.110.0080.00320.85
8.2.100.0070.00418.03
8.2.90.0030.00618.15
8.2.80.0040.00417.97
8.2.70.0060.00317.88
8.2.60.0040.00818.18
8.2.50.0090.00018.07
8.2.40.0040.00418.28
8.2.30.0000.00818.15
8.2.20.0030.00518.03
8.2.10.0040.00418.22
8.2.00.0030.00518.05
8.1.280.0160.00325.92
8.1.270.0030.01318.98
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0070.01422.69
8.1.230.0040.00821.04
8.1.220.0040.00417.91
8.1.210.0000.00919.10
8.1.200.0030.00617.60
8.1.190.0000.00817.48
8.1.180.0060.00318.10
8.1.170.0050.00518.77
8.1.160.0060.00322.11
8.1.150.0040.00418.95
8.1.140.0030.00519.49
8.1.130.0000.00717.96
8.1.120.0040.00417.66
8.1.110.0040.00417.71
8.1.100.0040.00417.76
8.1.90.0070.00017.69
8.1.80.0040.00417.71
8.1.70.0040.00417.77
8.1.60.0000.00817.67
8.1.50.0080.00017.72
8.1.40.0050.00317.76
8.1.30.0030.00517.75
8.1.20.0040.00417.74
8.1.10.0060.00317.77
8.1.00.0040.00417.69
8.0.300.0040.00420.02
8.0.290.0050.00316.88
8.0.280.0030.00318.52
8.0.270.0000.00717.31
8.0.260.0030.00317.41
8.0.250.0080.00017.23
8.0.240.0000.01117.20
8.0.230.0030.00317.19
8.0.220.0070.00017.07
8.0.210.0070.00017.14
8.0.200.0000.00717.23
8.0.190.0000.00817.13
8.0.180.0020.00517.23
8.0.170.0000.00717.10
8.0.160.0000.00717.26
8.0.150.0040.00417.20
8.0.140.0050.00317.16
8.0.130.0030.00313.54
8.0.120.0050.00317.13
8.0.110.0000.00717.14
8.0.100.0040.00416.99
8.0.90.0000.00716.99
8.0.80.0060.01217.13
8.0.70.0030.00517.03
8.0.60.0040.00417.16
8.0.50.0040.00417.04
8.0.30.0080.00817.24
8.0.20.0150.00817.45
8.0.10.0000.00717.21
8.0.00.0100.00916.90
7.4.330.0020.00215.21
7.4.320.0000.00616.81
7.4.300.0060.00316.73
7.4.290.0000.00716.71
7.4.280.0060.00316.61
7.4.270.0000.00716.87
7.4.260.0070.00316.80
7.4.250.0000.00816.79
7.4.240.0000.00816.77
7.4.230.0000.00716.66
7.4.220.0030.02116.86
7.4.210.0120.00916.76
7.4.200.0000.00716.82
7.4.160.0110.00616.96
7.4.150.0050.01417.40
7.4.140.0090.00817.86
7.4.130.0090.00816.79
7.4.120.0060.01216.74
7.4.110.0070.01816.82
7.4.100.0070.01116.71
7.4.90.0100.00716.74
7.4.80.0060.01319.39
7.4.70.0090.00916.55
7.4.60.0070.01116.63
7.4.50.0030.00616.29
7.4.40.0130.00316.77
7.4.30.0120.01216.70
7.4.00.0070.00715.34
7.3.330.0020.00513.40
7.3.320.0000.00513.33
7.3.310.0030.00316.53
7.3.300.0070.00016.41
7.3.290.0080.00616.54
7.3.280.0080.01016.46
7.3.270.0070.01117.40
7.3.260.0180.00616.64
7.3.250.0080.01016.68
7.3.240.0070.01316.55
7.3.230.0180.00616.89
7.3.210.0070.01116.45
7.3.200.0140.00619.39
7.3.190.0130.00616.84
7.3.180.0070.01016.49
7.3.170.0050.01816.82
7.3.160.0090.00916.89
7.3.120.0100.00715.39
7.3.110.0110.00714.96
7.3.100.0100.00714.80
7.3.90.0040.01415.39
7.3.80.0030.00715.12
7.3.70.0090.00915.15
7.3.60.0000.01115.10
7.3.50.0030.00814.79
7.3.40.0090.00615.04
7.3.30.0110.00015.15
7.3.20.0030.01016.89
7.3.10.0140.00516.76
7.3.00.0050.01016.60
7.2.330.0090.00916.83
7.2.320.0090.01016.72
7.2.310.0140.01017.08
7.2.300.0090.00917.05
7.2.290.0170.01217.04
7.2.250.0030.01215.33
7.2.240.0070.01315.27
7.2.230.0030.01215.23
7.2.220.0030.01015.31
7.2.210.0030.01015.14
7.2.200.0060.00615.22
7.2.190.0030.00615.37
7.2.180.0030.00715.41
7.2.170.0090.00615.43
7.2.130.0100.00816.74
7.2.120.0100.00617.10
7.2.110.0070.00717.07
7.2.100.0110.01016.79
7.2.90.0090.00616.97
7.2.80.0140.00717.05
7.2.70.0070.00917.07
7.2.60.0040.01017.04
7.2.50.0170.00717.00
7.2.40.0110.00616.93
7.2.30.0170.01316.82
7.2.20.0110.00817.02
7.2.10.0220.00816.96
7.2.00.0130.01117.07
7.1.330.0120.00316.24
7.1.320.0060.00615.97
7.1.310.0060.00316.13
7.1.300.0090.00316.07
7.1.290.0070.00716.06
7.1.280.0120.00315.84
7.1.270.0090.00615.96
7.1.260.0040.00715.95
7.1.250.0120.00315.88
7.1.240.0040.00816.09
7.1.230.0060.00616.07
7.1.220.0060.00315.95
7.1.210.0000.01016.09
7.1.200.0060.00615.89
7.1.190.0050.00516.16
7.1.180.0000.00815.86
7.1.170.0040.00415.80
7.1.160.0060.00316.09
7.1.150.0050.00516.15
7.1.140.0070.00416.06
7.1.130.0030.00715.95
7.1.120.0030.00615.94
7.1.110.0080.00416.01
7.1.100.0030.00717.12
7.1.90.0030.00616.09
7.1.80.0060.00616.11
7.1.70.0030.00816.69
7.1.60.0030.01617.82
7.1.50.0060.01016.66
7.1.40.0070.00716.09
7.1.30.0050.00515.92
7.1.20.0070.00716.07
7.1.10.0060.00615.89
7.1.00.0050.04919.19
7.0.330.0070.00315.54
7.0.320.0070.00415.66
7.0.310.0060.00315.61
7.0.300.0120.00015.66
7.0.290.0070.00415.59
7.0.280.0110.00415.78
7.0.270.0040.00415.44
7.0.260.0060.00315.55
7.0.250.0060.00615.61
7.0.240.0090.00015.73
7.0.230.0060.00315.73
7.0.220.0080.00415.42
7.0.210.0040.00715.79
7.0.200.0050.00516.32
7.0.190.0080.00015.43
7.0.180.0000.01115.50
7.0.170.0030.00715.76
7.0.160.0060.00615.50
7.0.150.0030.00915.45
7.0.140.0000.02518.78
7.0.130.0060.00915.32
7.0.120.0030.00915.37
7.0.110.0110.00315.63
7.0.100.0040.00815.41
7.0.90.0030.01015.59
7.0.80.0000.01215.62
7.0.70.0070.00315.79
7.0.60.0050.04717.77
7.0.50.0070.03716.66
7.0.40.0070.02316.97
7.0.30.0170.03516.75
7.0.20.0190.04016.87
7.0.10.0120.04516.94
7.0.00.0130.02816.87
5.6.380.0000.00914.77
5.6.370.0040.01114.50
5.6.360.0030.00714.46
5.6.350.0100.00314.43
5.6.340.0060.00614.20
5.6.330.0030.00614.65
5.6.320.0080.00314.63
5.6.310.0070.00414.26
5.6.300.0030.00914.39
5.6.290.0030.00914.73
5.6.280.0040.04017.66
5.6.270.0030.01014.24
5.6.260.0000.00914.48
5.6.250.0070.00714.14
5.6.240.0090.00614.29
5.6.230.0070.00714.75
5.6.220.0110.00714.47
5.6.210.0040.03617.55
5.6.200.0070.04216.17
5.6.190.0140.02017.39
5.6.180.0250.02617.23
5.6.170.0100.04517.21
5.6.160.0050.02417.34
5.6.150.0090.03816.37
5.6.140.0090.02516.18
5.6.130.0060.02516.19
5.6.120.0110.03517.69
5.6.110.0060.02317.70
5.6.100.0050.02517.63
5.6.90.0080.02317.76
5.6.80.0030.02517.35
5.6.70.0060.01014.44
5.6.60.0060.00614.21
5.6.50.0040.00714.40
5.6.40.0060.00614.36
5.6.30.0080.00414.48
5.6.20.0060.00614.43
5.6.10.0030.00914.28
5.6.00.0030.00614.47
5.5.380.0070.00511.16
5.5.370.0090.00511.11
5.5.360.0110.00011.26
5.5.350.0150.04215.69
5.5.340.0070.03014.52
5.5.330.0040.03315.79
5.5.320.0100.03015.77
5.5.310.0190.02315.89
5.5.300.0090.04214.54
5.5.290.0060.02114.64
5.5.280.0080.03716.12
5.5.270.0060.04416.02
5.5.260.0090.04216.01
5.5.250.0100.04015.99
5.5.240.0050.04015.73
5.5.230.0070.00311.16
5.5.220.0000.01011.23
5.5.210.0040.00711.04
5.5.200.0050.00511.18
5.5.190.0030.00711.18
5.5.180.0110.00010.79
5.5.170.0110.00011.32
5.5.160.0040.00411.20
5.5.150.0080.00411.46
5.5.140.0060.00311.34
5.5.130.0030.00310.94
5.5.120.0000.00611.46
5.5.110.0000.00811.05
5.5.100.0060.00611.18
5.5.90.0060.00611.13
5.5.80.0060.00011.10
5.5.70.0000.01011.01
5.5.60.0060.00610.75
5.5.50.0060.00011.17
5.5.40.0040.00710.90
5.5.30.0100.00011.13
5.5.20.0030.00611.27
5.5.10.0000.00610.78
5.5.00.0040.00710.81
5.4.450.0180.03615.37
5.4.440.0450.02715.17
5.4.430.0130.02715.11
5.4.420.0050.03315.26
5.4.410.0030.03215.05
5.4.400.0110.02615.10
5.4.390.0080.02814.84
5.4.380.0070.03214.86
5.4.370.0070.03014.90
5.4.360.0090.02814.86
5.4.350.0100.02814.94
5.4.340.0090.02814.77
5.4.330.0030.00611.00
5.4.320.0070.03014.84
5.4.310.0100.02814.81
5.4.300.0120.02514.95
5.4.290.0100.02714.94
5.4.280.0060.03014.76
5.4.270.0090.02814.91
5.4.260.0080.02914.72
5.4.250.0080.03014.78
5.4.240.0080.02914.69
5.4.230.0020.03414.66
5.4.220.0080.02814.91
5.4.210.0080.02814.89
5.4.200.0140.02513.90
5.4.190.0070.03014.94
5.4.180.0090.02814.88
5.4.170.0100.02814.75
5.4.160.0090.02614.79
5.4.150.0050.03114.95
5.4.140.0120.02513.70
5.4.130.0060.02913.77
5.4.120.0090.02813.48
5.4.110.0120.02513.73
5.4.100.0120.03013.74
5.4.90.0050.04313.63
5.4.80.0070.02913.80
5.4.70.0050.03313.68
5.4.60.0110.02613.60
5.4.50.0080.02813.54
5.4.40.0100.02813.70
5.4.30.0020.03213.53
5.4.20.0100.03013.66
5.4.10.0110.02313.52
5.4.00.0070.02913.48
5.3.290.0100.03012.76
5.3.280.0080.03112.57
5.3.270.0070.03212.76
5.3.260.0090.03612.60
5.3.250.0120.02512.66
5.3.240.0060.03412.64
5.3.230.0100.02812.70
5.3.220.0050.03512.60
5.3.210.0070.03212.56
5.3.200.0060.03212.58
5.3.190.0130.02312.54
5.3.180.0050.03012.64
5.3.170.0150.02912.75
5.3.160.0070.02812.62
5.3.150.0070.02912.65
5.3.140.0070.02812.60
5.3.130.0070.03012.57
5.3.120.0090.02912.61
5.3.110.0080.03212.69
5.3.100.0050.03012.33
5.3.90.0070.03012.30
5.3.80.0050.03112.28
5.3.70.0060.03112.23
5.3.60.0080.02712.32
5.3.50.0080.02712.20
5.3.40.0030.03212.24
5.3.30.0050.02812.36
5.3.20.0070.02812.12
5.3.10.0110.02612.13
5.3.00.0050.03012.09
5.2.170.0050.02310.78
5.2.160.0060.02210.80
5.2.150.0070.02310.86
5.2.140.0050.02510.81
5.2.130.0060.02210.80
5.2.120.0100.02110.87
5.2.110.0120.01810.82
5.2.100.0100.01810.79
5.2.90.0050.02310.79
5.2.80.0080.02210.77
5.2.70.0130.01710.79
5.2.60.0050.02610.77
5.2.50.0100.02010.75
5.2.40.0040.02510.73
5.2.30.0030.02510.76
5.2.20.0100.02310.72
5.2.10.0090.01810.74
5.2.00.0030.02510.62
5.1.60.0080.01610.25
5.1.50.0050.02010.28
5.1.40.0050.01910.30
5.1.30.0080.01810.48
5.1.20.0050.02310.43
5.1.10.0050.02110.29
5.1.00.0040.02110.28
5.0.50.0060.0139.59
5.0.40.0020.0179.53
5.0.30.0080.0209.41
5.0.20.0060.0139.36
5.0.10.0080.0149.38
5.0.00.0050.0219.40
4.4.90.0020.0148.16
4.4.80.0020.0158.19
4.4.70.0070.0088.19
4.4.60.0030.0128.21
4.4.50.0030.0128.18
4.4.40.0030.0198.19
4.4.30.0050.0118.19
4.4.20.0090.0078.22
4.4.10.0050.0108.22
4.4.00.0030.0208.20
4.3.110.0050.0108.19
4.3.100.0030.0138.16
4.3.90.0060.0108.13
4.3.80.0010.0208.15
4.3.70.0050.0118.14
4.3.60.0030.0138.15
4.3.50.0030.0138.14
4.3.40.0070.0178.12
4.3.30.0020.0157.56
4.3.20.0030.0137.51
4.3.10.0020.0137.53
4.3.00.0050.0148.84

preferences:
46.48 ms | 401 KiB | 5 Q