3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Initial datetimes $date1 = new DateTime('2014-08-07 10:00:00'); $date2 = new DateTime('2014-08-08 15:00:00'); // 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.0140.00318.42
8.3.50.0260.00322.11
8.3.40.0090.00618.96
8.3.30.0070.00719.17
8.3.20.0040.00420.19
8.3.10.0040.00421.91
8.3.00.0080.00018.05
8.2.180.0090.00616.75
8.2.170.0120.00322.96
8.2.160.0170.00320.52
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0070.01126.16
8.2.120.0080.00021.14
8.2.110.0090.00320.47
8.2.100.0080.00418.09
8.2.90.0060.00319.30
8.2.80.0000.00817.97
8.2.70.0000.00917.88
8.2.60.0070.00418.05
8.2.50.0060.00318.07
8.2.40.0000.00818.28
8.2.30.0000.00818.33
8.2.20.0040.00417.98
8.2.10.0040.00418.15
8.2.00.0000.00718.00
8.1.280.0100.00325.92
8.1.270.0030.00524.09
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0040.00423.92
8.1.230.0110.00019.14
8.1.220.0040.00418.03
8.1.210.0040.00418.77
8.1.200.0060.00317.60
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0080.00018.84
8.1.160.0020.00522.10
8.1.150.0030.00518.95
8.1.140.0000.00717.67
8.1.130.0000.00817.91
8.1.120.0040.00417.80
8.1.110.0050.00317.64
8.1.100.0030.00617.64
8.1.90.0000.00817.68
8.1.80.0050.00217.75
8.1.70.0040.00417.59
8.1.60.0090.00017.70
8.1.50.0000.00817.65
8.1.40.0080.00017.72
8.1.30.0040.00417.73
8.1.20.0000.00917.85
8.1.10.0040.00417.82
8.1.00.0050.00517.80
8.0.300.0000.00818.77
8.0.290.0000.00817.00
8.0.280.0000.00718.52
8.0.270.0030.00317.49
8.0.260.0000.00717.49
8.0.250.0020.00517.23
8.0.240.0070.00017.11
8.0.230.0070.00017.18
8.0.220.0070.00017.18
8.0.210.0000.00817.07
8.0.200.0070.00017.24
8.0.190.0000.00917.30
8.0.180.0040.00417.09
8.0.170.0080.00017.10
8.0.160.0070.00017.18
8.0.150.0000.00717.00
8.0.140.0000.00717.15
8.0.130.0000.00513.57
8.0.120.0040.00417.14
8.0.110.0040.00417.20
8.0.100.0040.00417.05
8.0.90.0000.00717.23
8.0.80.0070.01217.06
8.0.70.0000.00816.98
8.0.60.0040.00417.20
8.0.50.0080.00017.20
8.0.30.0140.01017.35
8.0.20.0160.00917.40
8.0.10.0000.00817.35
8.0.00.0090.00917.04
7.4.330.0000.00515.16
7.4.320.0030.00316.71
7.4.300.0030.00316.61
7.4.290.0050.00316.68
7.4.280.0040.00416.84
7.4.270.0080.00016.72
7.4.260.0000.00716.78
7.4.250.0040.00416.64
7.4.240.0050.00216.74
7.4.230.0070.00016.93
7.4.220.0070.01016.88
7.4.210.0060.00916.86
7.4.200.0000.00716.79
7.4.160.0090.00616.57
7.4.150.0150.00417.40
7.4.140.0120.00517.86
7.4.130.0170.00916.73
7.4.120.0110.00616.65
7.4.110.0030.01416.83
7.4.100.0060.01116.75
7.4.90.0060.01016.74
7.4.80.0150.00319.39
7.4.70.0100.00616.69
7.4.60.0090.01016.74
7.4.50.0000.00416.85
7.4.40.0090.00916.71
7.4.30.0080.00816.82
7.4.00.0100.00315.21
7.3.330.0070.00013.31
7.3.320.0000.00613.15
7.3.310.0000.00716.31
7.3.300.0070.00016.39
7.3.290.0150.00316.38
7.3.280.0060.01016.44
7.3.270.0110.00717.40
7.3.260.0060.01116.70
7.3.240.0110.00816.86
7.3.230.0100.00616.72
7.3.210.0090.01316.46
7.3.200.0100.00719.39
7.3.190.0060.01116.47
7.3.180.0110.00616.69
7.3.170.0030.01316.74
7.3.160.0060.01016.49
7.3.120.0030.01314.87
7.3.10.0100.00916.60
7.3.00.0170.00716.74
7.2.330.0040.01416.86
7.2.320.0080.01316.85
7.2.310.0070.01116.99
7.2.300.0080.00816.91
7.2.290.0090.00616.69
7.2.130.0090.00716.96
7.2.120.0080.01016.92
7.2.110.0060.01117.08
7.2.100.0100.00916.89
7.2.90.0090.00717.01
7.2.80.0090.01117.02
7.2.70.0090.00816.97
7.2.60.0050.00916.83
7.2.50.0070.01017.03
7.2.40.0130.00316.86
7.2.30.0090.01216.85
7.2.20.0060.01416.86
7.2.10.0170.00617.05
7.2.00.0070.00817.92
7.1.250.0070.01416.03
7.1.200.0080.00815.89
7.1.100.0060.00918.27
7.1.70.0000.00717.46
7.1.60.0070.01119.40
7.1.50.0060.01517.20
7.1.00.0030.07722.44
7.0.200.0000.00716.91
7.0.140.0100.06722.10
7.0.60.0030.06720.05
7.0.50.0070.05717.63
7.0.40.0070.04720.21
7.0.30.0230.04020.12
7.0.20.0200.05320.16
7.0.10.0030.09020.00
7.0.00.0100.04019.99
5.6.280.0070.06720.91
5.6.210.0100.07720.70
5.6.200.0170.07318.23
5.6.190.0100.06720.36
5.6.180.0430.06720.66
5.6.170.0200.04020.50
5.6.160.0070.05320.70
5.6.150.0030.05018.08
5.6.140.0070.08018.18
5.6.130.0030.08318.19
5.6.120.0130.04321.00
5.6.110.0030.04021.05
5.6.100.0100.08320.98
5.6.90.0200.06721.10
5.6.80.0100.07320.34
5.5.350.3170.03320.44
5.5.340.0030.06717.88
5.5.330.0030.08720.21
5.5.320.0330.07020.32
5.5.310.0470.06720.17
5.5.300.0100.04318.01
5.5.290.0070.08017.92
5.5.280.0070.03720.66
5.5.270.0170.07320.77
5.5.260.0030.04320.77
5.5.250.0100.07020.66
5.5.240.0070.04320.21
5.4.450.0400.03319.46
5.4.440.0330.03719.57
5.4.430.0370.04019.41
5.4.420.0370.04319.09
5.4.410.0230.04018.98
5.4.400.0200.03718.95
5.4.390.0430.04019.10
5.4.380.1070.07318.50
5.4.370.0230.05018.61
5.4.360.0270.06018.69
5.4.350.1200.05318.52
5.4.340.0330.06718.69
5.4.320.0080.03912.46
5.4.310.0100.03612.46
5.4.300.0070.03712.46
5.4.290.0060.03912.46
5.4.280.0040.03612.36
5.4.270.0060.03512.36
5.4.260.0060.03512.36
5.4.250.0050.03712.36
5.4.240.0070.03812.36
5.4.230.0080.04012.35
5.4.220.0080.03512.35
5.4.210.0050.03612.35
5.4.200.0050.03912.35
5.4.190.0070.03412.35
5.4.180.0040.03812.34
5.4.170.0050.03612.36
5.4.160.0100.03012.35
5.4.150.0060.03912.35
5.4.140.0050.04012.04
5.4.130.0060.04012.02
5.4.120.0080.03311.98
5.4.110.0040.04211.98
5.4.100.0050.03611.98
5.4.90.0040.03711.97
5.4.80.0020.04011.97
5.4.70.0060.03311.97
5.4.60.0070.03311.97
5.4.50.0040.03811.97
5.4.40.0060.03411.96
5.4.30.0060.03611.96
5.4.20.0060.03611.96
5.4.10.0080.03211.96
5.4.00.0040.03911.45
5.3.290.0110.03312.80
5.3.280.0070.03712.71
5.3.270.0050.04112.73
5.3.260.0060.03912.71
5.3.250.0060.03612.72
5.3.240.0070.03512.72
5.3.230.0060.03712.71
5.3.220.0040.03812.68
5.3.210.0080.03812.68
5.3.200.0050.03712.68
5.3.190.0080.03512.68
5.3.180.0070.04012.68
5.3.170.0060.03812.67
5.3.160.0050.03812.67
5.3.150.0080.04012.67
5.3.140.0070.04312.66
5.3.130.0090.03912.66
5.3.120.0090.03712.66
5.3.110.0070.03812.66
5.3.100.0040.03912.12
5.3.90.0070.03612.08
5.3.80.0070.03512.07
5.3.70.0040.03812.07
5.3.60.0060.03512.07
5.3.50.0080.03412.00
5.3.40.0070.03512.00
5.3.30.0060.03611.96
5.3.20.0060.03511.74
5.3.10.0080.03711.70
5.3.00.0040.03711.69
5.2.170.0040.0319.20
5.2.160.0070.0279.20
5.2.150.0060.0299.20
5.2.140.0030.0329.20
5.2.130.0060.0289.16
5.2.120.0050.0289.16
5.2.110.0050.0339.17
5.2.100.0050.0289.16
5.2.90.0060.0289.16
5.2.80.0070.0289.16
5.2.70.0050.0309.16
5.2.60.0050.0309.11
5.2.50.0070.0279.08
5.2.40.0080.0259.06
5.2.30.0040.0379.04
5.2.20.0050.0379.02
5.2.10.0050.0388.94
5.2.00.0070.0288.80
5.1.60.0030.0248.09
5.1.50.0060.0238.08
5.1.40.0050.0248.06
5.1.30.0050.0258.41
5.1.20.0010.0308.43
5.1.10.0030.0278.16
5.1.00.0070.0238.16
5.0.50.0010.0246.64
5.0.40.0020.0206.50
5.0.30.0040.0306.31
5.0.20.0020.0206.28
5.0.10.0050.0176.26
5.0.00.0030.0306.25
4.4.90.0040.0144.78
4.4.80.0040.0154.76
4.4.70.0020.0164.75
4.4.60.0030.0154.76
4.4.50.0030.0154.77
4.4.40.0030.0244.71
4.4.30.0040.0144.76
4.4.20.0040.0144.84
4.4.10.0010.0174.85
4.4.00.0020.0264.76
4.3.110.0040.0144.67
4.3.100.0030.0144.66
4.3.90.0020.0154.63
4.3.80.0030.0234.59
4.3.70.0030.0144.63
4.3.60.0030.0144.63
4.3.50.0020.0194.63
4.3.40.0040.0224.54
4.3.30.0010.0163.28
4.3.20.0020.0163.25
4.3.10.0030.0143.22
4.3.00.0070.02014.09

preferences:
41.31 ms | 401 KiB | 5 Q