3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Australia/Sydney'); // 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; // 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.55
8.3.50.0120.00717.61
8.3.40.0120.00318.91
8.3.30.0160.00018.93
8.3.20.0040.00418.98
8.3.10.0040.00420.76
8.3.00.0080.00017.71
8.2.180.0070.01017.13
8.2.170.0100.00522.96
8.2.160.0100.00722.21
8.2.150.0030.00524.18
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0000.00720.01
8.2.110.0060.00621.07
8.2.100.0070.00417.97
8.2.90.0000.00819.42
8.2.80.0000.00818.05
8.2.70.0080.00017.75
8.2.60.0030.00618.05
8.2.50.0040.00418.07
8.2.40.0050.00318.34
8.2.30.0000.00718.18
8.2.20.0040.00417.90
8.2.10.0050.00217.96
8.2.00.0000.00817.99
8.1.280.0130.00725.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0070.00320.95
8.1.230.0060.00620.97
8.1.220.0040.00418.77
8.1.210.0030.00518.83
8.1.200.0060.00317.60
8.1.190.0030.00617.66
8.1.180.0050.00318.10
8.1.170.0060.00320.70
8.1.160.0000.00718.99
8.1.150.0000.00718.95
8.1.140.0070.00017.72
8.1.130.0070.00017.98
8.1.120.0000.00717.81
8.1.110.0070.00317.74
8.1.100.0040.00417.68
8.1.90.0000.00717.60
8.1.80.0040.00417.75
8.1.70.0040.00417.71
8.1.60.0030.00517.80
8.1.50.0060.00317.64
8.1.40.0050.00217.72
8.1.30.0000.00817.73
8.1.20.0050.00517.78
8.1.10.0000.00817.77
8.1.00.0030.00517.61
8.0.300.0050.00320.16
8.0.290.0040.00417.00
8.0.280.0000.00818.47
8.0.270.0040.00417.42
8.0.260.0030.00318.79
8.0.250.0040.00417.26
8.0.240.0040.00717.20
8.0.230.0040.00417.06
8.0.220.0000.00817.20
8.0.210.0030.00317.14
8.0.200.0040.00417.12
8.0.190.0040.00417.13
8.0.180.0000.00817.20
8.0.170.0080.00017.02
8.0.160.0000.00717.21
8.0.150.0000.00817.12
8.0.140.0070.00317.05
8.0.130.0050.00013.55
8.0.120.0040.00417.16
8.0.110.0040.00417.05
8.0.100.0000.00817.21
8.0.90.0040.00417.04
8.0.80.0100.00717.16
8.0.70.0090.00017.21
8.0.60.0040.00417.21
8.0.50.0030.00517.02
8.0.30.0040.01517.14
8.0.20.0080.01017.47
8.0.10.0050.00217.13
8.0.00.0070.01516.96
7.4.330.0050.00014.96
7.4.320.0060.00016.63
7.4.300.0030.00316.77
7.4.290.0000.00716.82
7.4.280.0060.00316.83
7.4.270.0070.00016.70
7.4.260.0030.00313.50
7.4.250.0040.00416.75
7.4.240.0030.00616.84
7.4.230.0030.00316.91
7.4.220.0120.00916.79
7.4.210.0080.00916.79
7.4.200.0070.00016.52
7.4.190.0000.00716.86
7.4.160.0130.00816.78
7.4.150.0090.01317.07
7.4.140.0080.00817.32
7.4.130.0120.01016.78
7.4.120.0020.01916.64
7.4.110.0140.00316.75
7.4.100.0030.01316.52
7.4.90.0030.01916.58
7.4.80.0150.00718.80
7.4.70.0150.00716.69
7.4.60.0130.00316.80
7.4.50.0060.00316.54
7.4.40.0030.01322.27
7.4.30.0090.00616.60
7.4.00.0070.01015.26
7.3.330.0060.00013.46
7.3.320.0000.00713.31
7.3.310.0050.00216.42
7.3.300.0040.00416.50
7.3.290.0160.00316.50
7.3.280.0130.00716.47
7.3.270.0070.01017.07
7.3.260.0160.00618.24
7.3.250.0100.00916.62
7.3.240.0130.00316.77
7.3.230.0100.01016.78
7.3.210.0120.00616.79
7.3.200.0080.01519.39
7.3.190.0170.00316.82
7.3.180.0080.00816.77
7.3.170.0080.00816.67
7.3.160.0060.01016.58
7.3.120.0070.00715.24
7.2.330.0100.00716.84
7.2.320.0070.01016.83
7.2.310.0150.00616.84
7.2.300.0030.01317.07
7.2.290.0060.01016.68
7.2.00.0030.01219.71
7.1.100.0000.01318.36
7.1.70.0040.00417.51
7.1.60.0170.00719.40
7.1.50.0030.01017.11
7.1.00.0030.06022.36
7.0.200.0030.00516.66
7.0.140.0000.07722.09
7.0.110.0330.08719.94
7.0.100.0200.08319.96
7.0.90.0200.08020.05
7.0.80.0200.06019.98
7.0.70.0200.04019.87
7.0.60.0030.05020.04
7.0.50.0070.04320.42
7.0.40.0100.03720.13
7.0.30.0100.04720.18
7.0.20.0070.04020.09
7.0.10.0070.04020.13
7.0.00.0100.04020.23
5.6.280.0070.07021.13
5.6.260.0070.07720.68
5.6.250.0200.06020.74
5.6.240.0000.09020.71
5.6.230.0070.08320.67
5.6.220.0000.04320.54
5.6.210.0000.04320.62
5.6.200.0030.04321.15
5.6.190.0030.04721.15
5.6.180.0000.05721.00
5.6.170.0030.05321.12
5.6.160.0000.04720.93
5.6.150.0100.05721.15
5.6.140.0030.04321.14
5.6.130.0100.07720.96
5.6.120.0070.04021.23
5.6.110.0030.04321.13
5.6.100.0030.08721.21
5.6.90.0030.06721.07
5.6.80.0100.05020.53
5.6.70.0070.07020.37
5.6.60.0030.05720.51
5.6.50.0000.04320.53
5.6.40.0030.05320.65
5.6.30.0070.03720.54
5.6.20.0070.04020.63
5.6.10.0000.04320.50
5.6.00.0070.03720.37
5.5.380.0070.08020.52
5.5.370.0130.07020.26
5.5.360.0030.04320.24
5.5.350.0030.04720.44
5.5.340.0000.04321.04
5.5.330.0030.04721.00
5.5.320.0030.04320.93
5.5.310.0100.05721.02
5.5.300.0070.05720.96
5.5.290.0070.05720.78
5.5.280.0030.07320.90
5.5.270.0000.04720.97
5.5.260.0030.05720.80
5.5.250.0100.07020.60
5.5.240.0000.04320.23
5.5.230.0170.02720.33
5.5.220.0000.04020.25
5.5.210.0000.05020.25
5.5.200.0030.04020.38
5.5.190.0030.04720.26
5.5.180.0070.03720.40
5.5.160.0100.03720.10
5.5.150.0100.06720.25
5.5.140.0100.08020.24
5.5.130.0000.04020.32
5.5.120.0100.08020.09
5.5.110.0100.07320.32
5.5.100.0070.06020.20
5.5.90.0070.07720.21
5.5.80.0070.07719.99
5.5.70.0070.05320.19
5.5.60.0130.07020.04
5.5.50.0170.07320.00
5.5.40.0070.04720.13
5.5.30.0130.07320.13
5.5.20.0200.06720.07
5.5.10.0170.07020.20
5.5.00.0030.05720.02
5.4.450.0100.03319.58
5.4.440.0100.05319.44
5.4.430.0030.04019.39
5.4.420.0070.03319.57
5.4.410.0000.06719.46
5.4.400.0030.04019.13
5.4.390.0070.03318.93
5.4.380.0100.03719.14
5.4.370.0030.03719.16
5.4.360.0100.04319.03
5.4.350.0070.04019.11
5.4.340.0000.04019.12
5.4.320.0070.03318.95
5.4.310.0070.07319.12
5.4.300.0070.07319.27
5.4.290.0070.07719.17
5.4.280.0100.07318.93
5.4.270.0100.07319.02
5.4.260.0030.04318.95
5.4.250.0070.06718.92
5.4.240.0130.06319.16
5.4.230.0100.07019.07
5.4.220.0070.05719.00
5.4.210.0070.05019.00
5.4.200.0070.07719.12
5.4.190.0100.07718.97
5.4.180.0070.07719.11
5.4.170.0170.07019.15
5.4.160.0030.05318.98
5.4.150.0100.07319.00
5.4.140.0070.07316.50
5.4.130.0070.07016.32
5.4.120.0030.07716.30
5.4.110.0030.06316.47
5.4.100.0070.07316.54
5.4.90.0030.07016.43
5.4.80.0070.07316.22
5.4.70.0100.06016.41
5.4.60.0100.06716.43
5.4.50.0070.07316.26
5.4.40.0270.05316.31
5.4.30.0070.06316.52
5.4.20.0070.06316.55
5.4.10.0100.07316.16
5.4.00.0070.06315.76
5.3.290.0070.08014.62
5.3.280.0000.07314.50
5.3.270.0000.07314.42
5.3.260.0070.07314.54
5.3.250.0100.06314.56
5.3.240.0130.06714.49
5.3.230.0070.08014.63
5.3.220.0030.07714.50
5.3.210.0170.07314.50
5.3.200.0130.06314.50
5.3.190.0070.03714.40
5.3.180.0000.07014.43
5.3.170.0130.07314.58
5.3.160.0070.06314.45
5.3.150.0100.07714.57
5.3.140.0170.06714.46
5.3.130.0100.07314.34
5.3.120.0100.07714.57
5.3.110.0030.07714.44
5.3.100.0000.08014.07
5.3.90.0030.07013.96
5.3.80.0100.06013.93
5.3.70.0130.06313.93
5.3.60.0170.06314.11
5.3.50.0000.07713.82
5.3.40.0100.04013.82
5.3.30.0130.05713.99
5.3.20.0070.04313.57
5.3.10.0030.07013.72
5.3.00.0030.07013.72
5.2.170.0030.06311.89
5.2.160.0100.05311.89
5.2.150.0100.05711.89
5.2.140.0070.06311.89
5.2.130.0100.05711.89
5.2.120.0070.05711.89
5.2.110.0100.05011.89
5.2.100.0030.06311.89
5.2.90.0100.05711.89
5.2.80.0030.06311.89
5.2.70.0030.03711.89
5.2.60.0070.06011.89
5.2.50.0030.06311.89
5.2.40.0000.06711.89
5.2.30.0070.05311.89
5.2.20.0030.04311.89
5.2.10.0130.03711.89
5.2.00.0070.06311.89
5.1.60.0100.04711.89
5.1.50.0030.05711.89
5.1.40.0070.04711.89
5.1.30.0100.04711.89
5.1.20.0000.04311.89
5.1.10.0070.05711.89
5.1.00.0070.05011.89
5.0.50.0030.04311.89
5.0.40.0070.03711.89
5.0.30.0000.04711.89
5.0.20.0000.02311.89
5.0.10.0030.05311.89
5.0.00.0000.04311.89
4.4.90.0100.03011.89
4.4.80.0030.03311.89
4.4.70.0070.02711.89
4.4.60.0070.03311.89
4.4.50.0000.03711.89
4.4.40.0030.04311.89
4.4.30.0000.03711.89
4.4.20.0030.03311.89
4.4.10.0000.04311.89
4.4.00.0030.02711.89
4.3.110.0030.03311.89
4.3.100.0100.02311.89
4.3.90.0030.02711.89
4.3.80.0070.04711.89
4.3.70.0030.03311.89
4.3.60.0000.02011.89
4.3.50.0100.02711.89
4.3.40.0000.05011.89
4.3.30.0000.03011.89
4.3.20.0000.03311.89
4.3.10.0000.02711.89
4.3.00.0000.03011.89

preferences:
57.74 ms | 400 KiB | 5 Q