3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Initial datetimes $date1 = new DateTime('2015-04-08 14:25:00'); $date2 = new DateTime('2015-04-08 16:15: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.0070.00718.43
8.3.50.0120.00722.24
8.3.40.0040.01119.01
8.3.30.0110.00419.21
8.3.20.0040.00420.34
8.3.10.0040.00421.62
8.3.00.0060.00319.50
8.2.180.0040.01516.63
8.2.170.0030.01622.96
8.2.160.0130.00720.52
8.2.150.0120.00624.18
8.2.140.0120.00624.66
8.2.130.0070.00026.16
8.2.120.0060.01319.47
8.2.110.0000.00919.51
8.2.100.0000.01217.88
8.2.90.0040.00419.30
8.2.80.0000.00818.00
8.2.70.0060.00317.75
8.2.60.0000.00818.29
8.2.50.0000.00818.07
8.2.40.0040.00420.13
8.2.30.0000.00718.21
8.2.20.0000.00818.09
8.2.10.0000.00818.27
8.2.00.0080.00018.00
8.1.280.0120.00925.92
8.1.270.0080.00020.77
8.1.260.0040.00426.35
8.1.250.0070.01028.09
8.1.240.0110.00724.00
8.1.230.0040.00717.73
8.1.220.0000.00817.77
8.1.210.0090.00018.77
8.1.200.0000.00917.60
8.1.190.0030.00517.38
8.1.180.0030.00618.10
8.1.170.0030.00619.09
8.1.160.0000.00722.16
8.1.150.0040.00419.03
8.1.140.0000.00717.61
8.1.130.0000.00717.98
8.1.120.0070.00017.66
8.1.110.0000.00717.77
8.1.100.0040.00417.71
8.1.90.0000.00717.73
8.1.80.0040.00417.75
8.1.70.0040.00417.64
8.1.60.0040.00417.83
8.1.50.0040.00417.62
8.1.40.0030.00517.77
8.1.30.0040.00417.85
8.1.20.0040.00417.80
8.1.10.0000.00817.77
8.1.00.0060.00317.68
8.0.300.0030.00518.77
8.0.290.0000.00717.00
8.0.280.0000.00718.55
8.0.270.0070.00017.29
8.0.260.0000.00917.42
8.0.250.0030.00317.27
8.0.240.0000.00617.21
8.0.230.0000.00717.25
8.0.220.0000.00717.04
8.0.210.0050.00217.18
8.0.200.0080.00017.21
8.0.190.0000.00817.24
8.0.180.0000.00717.18
8.0.170.0030.00617.15
8.0.160.0000.00717.16
8.0.150.0030.00317.05
8.0.140.0050.00217.10
8.0.130.0000.00713.49
8.0.120.0050.00317.20
8.0.110.0030.00517.22
8.0.100.0000.00716.98
8.0.90.0020.00517.06
8.0.80.0090.00617.16
8.0.70.0050.00217.20
8.0.60.0000.00817.18
8.0.50.0050.00317.29
8.0.30.0180.00517.43
8.0.20.0090.00917.40
8.0.10.0000.00817.17
8.0.00.0120.00516.96
7.4.330.0020.00215.14
7.4.320.0030.00316.72
7.4.300.0070.00016.82
7.4.290.0000.00816.79
7.4.280.0030.00316.70
7.4.270.0040.00416.81
7.4.260.0030.00316.71
7.4.250.0040.00416.78
7.4.240.0030.00416.74
7.4.230.0030.00316.56
7.4.220.0130.00716.77
7.4.210.0060.00916.72
7.4.200.0070.00016.72
7.4.160.0090.00616.84
7.4.150.0110.00717.40
7.4.140.0100.00817.86
7.4.130.0140.01016.61
7.4.120.0070.01016.84
7.4.110.0140.00416.58
7.4.100.0120.00916.68
7.4.90.0070.01116.75
7.4.80.0080.01119.39
7.4.70.0070.01416.98
7.4.60.0120.00416.75
7.4.50.0030.00316.67
7.4.40.0030.01316.57
7.4.30.0070.01016.89
7.4.00.0080.00414.94
7.3.330.0030.00313.33
7.3.320.0110.00513.26
7.3.310.0050.00316.46
7.3.300.0070.00016.45
7.3.290.0080.00816.40
7.3.280.0090.00616.39
7.3.270.0180.00617.40
7.3.260.0090.01216.62
7.3.250.0090.01016.54
7.3.240.0120.00616.78
7.3.230.0120.00616.56
7.3.210.0070.01116.58
7.3.200.0120.00319.39
7.3.190.0130.00316.67
7.3.180.0110.00716.42
7.3.170.0060.01016.54
7.3.160.0070.01016.45
7.2.330.0130.00716.79
7.2.320.0030.01416.81
7.2.310.0140.00716.72
7.2.300.0120.01016.71
7.2.290.0030.01917.02
7.2.00.0060.00919.71
7.1.100.0070.00418.37
7.1.70.0000.00817.23
7.1.60.0120.00919.50
7.1.50.0160.00616.85
7.1.00.0030.07722.36
7.0.200.0600.00014.72
7.0.140.0000.06022.12
7.0.60.0170.07720.02
7.0.50.0130.03717.77
7.0.40.0070.05320.40
7.0.30.0200.04020.20
7.0.20.0200.07020.00
7.0.10.0270.05720.33
7.0.00.0130.07020.01
5.6.280.0030.06721.15
5.6.210.0130.06020.71
5.6.200.0070.04018.18
5.6.190.0100.07320.27
5.6.180.0070.08020.38
5.6.170.0370.07320.52
5.6.160.0170.07320.71
5.6.150.0100.08318.14
5.6.140.0030.05318.23
5.6.130.0070.04018.20
5.6.120.0030.04321.14
5.6.110.0100.07321.14
5.6.100.0200.07020.98
5.6.90.0030.06021.01
5.6.80.0070.03320.36
5.6.70.4230.03320.53
5.5.350.0430.05720.43
5.5.340.0100.07717.92
5.5.330.0100.08020.40
5.5.320.0070.08320.15
5.5.310.0330.07320.12
5.5.300.0100.07717.98
5.5.290.0070.08717.95
5.5.280.0170.04320.97
5.5.270.0170.06720.93
5.5.260.0030.08020.72
5.5.250.0070.05720.66
5.5.240.0030.04720.29
5.4.450.0270.06719.64
5.4.440.0900.06319.64
5.4.430.0830.06319.43
5.4.420.0130.05319.15
5.4.410.0100.07718.95
5.4.400.0400.07718.77
5.4.390.0470.06318.75
5.4.380.0330.05718.57
5.4.370.0430.05318.44
5.4.360.0170.06718.47
5.4.350.0170.06318.61
5.4.340.0170.07318.48
5.4.320.0330.07718.66
5.4.310.0370.07018.64
5.4.300.0300.05718.64
5.4.290.0430.05018.70
5.4.280.0530.05018.66
5.4.270.0370.06318.53
5.4.260.0230.06018.50
5.4.250.0370.05318.63
5.4.240.1330.05718.67
5.4.230.0330.05318.78
5.4.220.0230.06318.58
5.4.210.0430.05318.63
5.4.200.0430.05016.52
5.4.190.0230.05718.68
5.4.180.0300.05018.49
5.4.170.0600.05718.57
5.4.160.0300.05018.75
5.4.150.0330.05718.50
5.4.140.0400.04016.16
5.4.130.0400.03716.07
5.4.120.0430.05316.07
5.4.110.1070.04016.40
5.4.100.0630.06016.22
5.4.90.0370.06316.33
5.4.80.0230.05716.31
5.4.70.0430.05316.04
5.4.60.0330.04716.17
5.4.50.0330.05016.30
5.4.40.0500.04016.17
5.4.30.0500.05716.14
5.4.20.0530.06016.13
5.4.10.0500.04316.15
5.4.00.0330.05315.75
5.3.290.0430.05314.59
5.3.280.0400.04314.61
5.3.270.0300.05714.53
5.3.260.0300.06314.54
5.3.250.0370.04714.55
5.3.240.0370.07014.62
5.3.230.0430.06714.57
5.3.220.0430.05014.48
5.3.210.0470.06314.68
5.3.200.0430.06714.50
5.3.190.0370.05014.64
5.3.180.0430.04314.63
5.3.170.0400.05014.61
5.3.160.0470.06314.57
5.3.150.0400.05314.52
5.3.140.0330.05314.62
5.3.130.0430.04314.46
5.3.120.0300.05714.48
5.3.110.0270.06014.48
5.3.100.0270.05314.14
5.3.90.0230.07014.03
5.3.80.0170.05014.06
5.3.70.0200.05314.13
5.3.60.0800.04713.93
5.3.50.0470.05713.99
5.3.40.0600.05313.94
5.3.30.0400.06714.02
5.3.20.0330.06013.70
5.3.10.0400.05313.64
5.3.00.0300.06013.64
5.2.170.0230.04711.13
5.2.160.0270.03711.11
5.2.150.0200.07011.20
5.2.140.0270.04011.31
5.2.130.0300.04711.07
5.2.120.0330.03311.04
5.2.110.0330.03711.19
5.2.100.0270.04311.10
5.2.90.0300.04311.11
5.2.80.0200.04711.10
5.2.70.0300.03311.07
5.2.60.0370.03011.20
5.2.50.0270.04311.10
5.2.40.0200.04011.02
5.2.30.0200.04311.04
5.2.20.0170.04711.13
5.2.10.0200.06010.98
5.2.00.0230.04010.88
5.1.60.0170.04010.00
5.1.50.0270.03310.05
5.1.40.0200.04010.05
5.1.30.0270.03710.34
5.1.20.0130.04310.39
5.1.10.0170.04010.11
5.1.00.0230.03710.08
5.0.50.0130.0278.54
5.0.40.0130.0308.44
5.0.30.0170.0408.33
5.0.20.0100.0308.23
5.0.10.0070.0308.26
5.0.00.0200.0378.23
4.4.90.0170.0175.90
4.4.80.0100.0235.91
4.4.70.0100.0235.85
4.4.60.0030.0275.85
4.4.50.0070.0235.91
4.4.40.0070.0375.87
4.4.30.0070.0235.93
4.4.20.0100.0205.88
4.4.10.0130.0205.92
4.4.00.0130.0335.95
4.3.110.0130.0205.81
4.3.100.0070.0235.81
4.3.90.0070.0235.81
4.3.80.0100.0375.81
4.3.70.0130.0275.82
4.3.60.0130.0175.82
4.3.50.0070.0235.81
4.3.40.0130.0305.81
4.3.30.0030.0235.81
4.3.20.0100.0175.81
4.3.10.0070.0205.81
4.3.00.0130.0206.69

preferences:
50.39 ms | 401 KiB | 5 Q