3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Initial datetimes $date1 = new DateTime('2012-03-22 11:29:16', new DateTimeZone('Australia/Sydney')); $date2 = new DateTime('2012-03-24 03:58:58', new DateTimeZone('Australia/Sydney')); // 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.70.0180.00316.63
8.3.60.0140.00318.68
8.3.50.0110.00917.48
8.3.40.0070.00718.92
8.3.30.0090.00619.04
8.3.20.0030.00618.90
8.3.10.0060.00319.07
8.3.00.0050.00319.50
8.2.180.0080.00816.75
8.2.170.0070.00722.96
8.2.160.0150.00021.38
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0050.00326.16
8.2.120.0030.00520.96
8.2.110.0030.00620.91
8.2.100.0090.00318.16
8.2.90.0040.00419.61
8.2.80.0040.00419.24
8.2.70.0030.00617.75
8.2.60.0080.00017.80
8.2.50.0050.00318.07
8.2.40.0040.00418.28
8.2.30.0040.00418.23
8.2.20.0060.00317.90
8.2.10.0040.00418.09
8.2.00.0030.00618.13
8.1.280.0130.00325.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0100.00022.71
8.1.230.0040.00721.00
8.1.220.0030.00517.74
8.1.210.0050.00719.04
8.1.200.0060.00317.60
8.1.190.0040.00417.66
8.1.180.0030.00518.10
8.1.170.0040.00418.86
8.1.160.0030.00618.95
8.1.150.0000.00818.91
8.1.140.0000.00717.78
8.1.130.0070.00017.98
8.1.120.0040.00417.61
8.1.110.0000.00817.68
8.1.100.0020.00517.73
8.1.90.0040.00417.79
8.1.80.0000.00717.72
8.1.70.0080.00017.61
8.1.60.0040.00417.82
8.1.50.0080.00017.73
8.1.40.0040.00417.65
8.1.30.0030.00617.88
8.1.20.0030.00517.70
8.1.10.0070.00017.82
8.1.00.0040.00417.74
8.0.300.0000.00720.08
8.0.290.0000.00716.88
8.0.280.0030.00318.52
8.0.270.0030.00317.33
8.0.260.0000.00717.10
8.0.250.0080.00017.16
8.0.240.0000.00817.21
8.0.230.0050.00217.20
8.0.220.0080.00017.18
8.0.210.0000.00717.03
8.0.200.0030.00617.20
8.0.190.0000.00717.22
8.0.180.0040.00817.09
8.0.170.0030.00617.20
8.0.160.0070.00017.22
8.0.150.0000.00917.17
8.0.140.0000.00717.02
8.0.130.0050.00013.60
8.0.120.0040.00417.13
8.0.110.0000.00717.02
8.0.100.0050.00316.98
8.0.90.0070.00017.22
8.0.80.0170.00417.12
8.0.70.0030.00517.02
8.0.60.0000.00717.14
8.0.50.0040.00417.23
8.0.30.0100.01417.28
8.0.20.0040.01617.22
8.0.10.0070.00017.21
8.0.00.0090.00916.95
7.4.330.0030.00313.21
7.4.320.0030.00316.61
7.4.300.0030.00316.70
7.4.290.0100.00316.73
7.4.280.0070.00016.81
7.4.270.0030.00516.84
7.4.260.0030.00213.51
7.4.250.0050.00316.67
7.4.240.0040.00316.80
7.4.230.0030.00316.81
7.4.220.0070.01116.60
7.4.210.0070.00816.75
7.4.200.0000.00816.88
7.4.190.0070.00016.95
7.4.160.0060.01016.81
7.4.150.0110.00716.69
7.4.140.0130.00616.75
7.4.130.0110.00616.78
7.4.120.0070.01016.70
7.4.110.0070.01116.53
7.4.100.0100.01016.80
7.4.90.0030.01316.59
7.4.80.0180.00316.59
7.4.70.0140.00316.62
7.4.60.0030.01416.75
7.4.50.0070.00716.73
7.4.40.0070.00716.59
7.4.30.0000.01616.74
7.4.10.0100.00715.04
7.4.00.0080.00815.06
7.3.330.0030.00313.40
7.3.320.0030.00313.35
7.3.310.0040.00416.32
7.3.300.0030.00316.44
7.3.290.0140.00016.49
7.3.280.0070.00916.50
7.3.270.0060.01016.87
7.3.260.0100.01316.46
7.3.250.0110.00916.83
7.3.240.0100.01116.75
7.3.230.0070.01416.73
7.3.210.0080.00816.81
7.3.200.0060.01219.39
7.3.190.0070.01516.65
7.3.180.0060.00916.73
7.3.170.0100.00616.58
7.3.160.0060.01016.55
7.3.130.0090.01014.99
7.3.120.0060.00915.07
7.3.110.0090.00915.11
7.3.100.0120.00515.02
7.3.90.0080.01014.95
7.3.80.0050.00714.91
7.3.70.0080.00515.00
7.3.60.0050.01015.02
7.3.50.0050.00915.00
7.3.40.0040.00914.76
7.3.30.0040.01014.94
7.3.20.0030.00916.74
7.3.10.0080.00616.89
7.3.00.0100.00316.66
7.2.330.0130.00416.66
7.2.320.0090.00917.11
7.2.310.0070.01617.00
7.2.300.0070.01116.80
7.2.290.0120.00916.80
7.2.260.0070.01315.34
7.2.250.0050.01215.30
7.2.240.0050.01315.24
7.2.230.0060.01215.42
7.2.220.0070.00615.28
7.2.210.0090.00615.36
7.2.200.0060.00915.37
7.2.190.0060.01115.27
7.2.180.0070.00715.21
7.2.170.0060.00815.39
7.2.160.0030.01315.28
7.2.150.0000.01717.17
7.2.140.0040.00717.12
7.2.130.0080.00417.01
7.2.120.0100.00616.88
7.2.110.0030.01017.14
7.2.100.0030.01317.18
7.2.90.0080.00816.96
7.2.80.0070.01116.94
7.2.70.0030.01217.04
7.2.60.0080.00916.84
7.2.50.0030.01317.25
7.2.40.0030.01417.02
7.2.30.0070.01116.85
7.2.20.0060.00917.25
7.2.10.0100.00617.13
7.2.00.0100.00618.33
7.1.330.0040.01116.16
7.1.320.0090.00416.03
7.1.310.0050.00516.02
7.1.300.0090.00715.87
7.1.290.0030.00916.02
7.1.280.0060.00615.98
7.1.270.0090.00415.77
7.1.260.0050.00816.00
7.1.250.0060.01015.98
7.1.240.0100.00715.95
7.1.230.0060.00915.70
7.1.220.0110.00615.94
7.1.210.0060.00615.86
7.1.200.0070.00715.69
7.1.190.0040.00916.01
7.1.180.0040.01215.83
7.1.170.0030.01015.97
7.1.160.0060.00616.04
7.1.150.0030.01015.89
7.1.140.0090.00616.11
7.1.130.0060.00616.18
7.1.120.0070.01015.95
7.1.110.0060.00316.11
7.1.100.0110.01017.14
7.1.90.0060.01215.85
7.1.80.0030.00815.98
7.1.70.0070.00716.74
7.1.60.0060.01317.60
7.1.50.0030.00816.64
7.1.40.0100.00315.95
7.1.30.0080.01216.09
7.1.20.0060.00915.94
7.1.10.0060.00615.73
7.1.00.0020.04119.22
7.0.330.0090.00615.52
7.0.320.0060.01015.52
7.0.310.0120.00315.50
7.0.300.0000.01115.62
7.0.290.0110.00415.48
7.0.280.0040.00715.32
7.0.270.0000.01615.20
7.0.260.0030.00915.57
7.0.250.0100.00815.46
7.0.240.0070.00715.59
7.0.230.0070.00715.11
7.0.220.0080.00615.05
7.0.210.0040.01215.39
7.0.200.0100.00715.22
7.0.190.0030.01015.21
7.0.180.0120.00615.40
7.0.170.0040.01115.44
7.0.160.0070.01015.58
7.0.150.0080.00515.62
7.0.140.0050.04018.95
7.0.130.0080.00815.57
7.0.120.0050.04018.80
7.0.110.0070.00715.50
7.0.100.0090.00615.56
7.0.90.0110.00415.57
7.0.80.0110.00415.42
7.0.70.0030.01215.62
7.0.60.0020.03417.73
7.0.50.0030.02716.74
7.0.40.0060.04515.64
7.0.30.0080.03315.72
7.0.20.0080.04515.45
7.0.10.0050.04715.70
7.0.00.0030.04715.53
5.6.400.0030.00714.38
5.6.390.0040.01414.36
5.6.380.0140.00714.23
5.6.370.0000.01014.29
5.6.360.0060.00914.23
5.6.350.0120.00314.55
5.6.340.0100.00614.42
5.6.330.0070.00714.84
5.6.320.0040.01214.06
5.6.310.0040.01114.16
5.6.300.0000.01214.66
5.6.290.0100.00314.65
5.6.280.0060.00614.98
5.6.270.0080.00814.69
5.6.260.0120.00814.33
5.6.250.0070.01014.67
5.6.240.0070.01014.43
5.6.230.0030.01214.68
5.6.220.0060.00914.32
5.6.210.0070.03817.51
5.6.200.0100.03516.31
5.6.190.0060.03416.28
5.6.180.0050.02816.17
5.6.170.0070.03016.38
5.6.160.0020.03716.16
5.6.150.0090.04416.27
5.6.140.0100.03016.20
5.6.130.0080.03816.30
5.6.120.0180.01716.15
5.6.110.0050.03816.23
5.6.100.0050.04716.35
5.6.90.0050.04016.18
5.6.80.0030.03416.07
5.6.70.0030.02915.95
5.6.60.0070.02315.87
5.6.50.0050.04515.77
5.6.40.0060.04416.07
5.6.30.0070.04016.04
5.6.20.0090.03815.88
5.6.10.0060.02816.01
5.6.00.0090.02816.06
5.5.380.0110.00414.61
5.5.370.0120.00614.28
5.5.360.0030.00614.14
5.5.350.0190.03417.53
5.5.340.0050.04916.21
5.5.330.0030.02816.26
5.5.320.0050.04216.25
5.5.310.0110.04116.19
5.5.300.0050.05016.38
5.5.290.0050.03216.03
5.5.280.0030.04416.15
5.5.270.0100.04416.25
5.5.260.0060.03616.09
5.5.250.0120.03215.93
5.5.240.0070.02915.64
5.5.230.0040.03515.74
5.5.220.0050.02315.63
5.5.210.0070.02515.76
5.5.200.0070.03015.76
5.5.190.0050.04615.54
5.5.180.0060.03615.75
5.5.170.0090.01014.17
5.5.160.0080.04215.80
5.5.150.0060.02815.79
5.5.140.0050.04715.91
5.5.130.0050.03015.75
5.5.120.0110.03715.97
5.5.110.0050.04116.00
5.5.100.0030.04515.92
5.5.90.0070.03215.64
5.5.80.0090.03715.83
5.5.70.0080.02715.80
5.5.60.0100.04015.92
5.5.50.0110.02115.84
5.5.40.0020.02715.82
5.5.30.0050.02315.89
5.5.20.0050.02115.72
5.5.10.0050.02215.66
5.5.00.0010.02615.76
5.4.450.0050.04515.22
5.4.440.0070.03515.42
5.4.430.0050.04415.16
5.4.420.0050.04315.31
5.4.410.0070.04315.27
5.4.400.0050.04415.07
5.4.390.0020.03515.14
5.4.380.0070.03915.13
5.4.370.0090.03615.07
5.4.360.0070.02915.03
5.4.350.0060.03615.00
5.4.340.0110.03914.93
5.4.330.0070.00710.94
5.4.320.0190.01614.97
5.4.310.0070.04014.92
5.4.300.0070.04014.96
5.4.290.0010.04415.11
5.4.280.0070.03815.10
5.4.270.0080.04015.08
5.4.260.0070.02815.28
5.4.250.0070.04015.10
5.4.240.0070.02715.13
5.4.230.0060.03915.22
5.4.220.0060.02814.95
5.4.210.0020.02414.99
5.4.200.0070.01915.00
5.4.190.0060.02014.96
5.4.180.0110.01515.01
5.4.170.0030.02115.05
5.4.160.0030.02314.93
5.4.150.0040.02215.16
5.4.140.0070.01813.85
5.4.130.0030.02213.79
5.4.120.0050.01913.76
5.4.110.0070.01713.64
5.4.100.0010.02413.79
5.4.90.0080.01713.77
5.4.80.0090.01613.66
5.4.70.0050.02013.72
5.4.60.0060.01913.73
5.4.50.0050.01713.72
5.4.40.0040.02013.91
5.4.30.0020.02513.82
5.4.20.0020.02313.61
5.4.10.0050.01913.70
5.4.00.0080.01813.42
5.3.290.0070.04012.75
5.3.280.0060.03112.64
5.3.270.0050.02212.67
5.3.260.0000.02512.74
5.3.250.0040.02212.69
5.3.240.0050.02112.57
5.3.230.0020.02412.70
5.3.220.0050.01912.56
5.3.210.0090.02212.42
5.3.200.0040.02212.44
5.3.190.0020.02712.56
5.3.180.0050.02112.60
5.3.170.0020.02412.63
5.3.160.0080.01812.61
5.3.150.0020.02412.67
5.3.140.0050.02012.69
5.3.130.0070.01712.60
5.3.120.0030.02012.61
5.3.110.0020.02412.55
5.3.100.0030.02412.35
5.3.90.0020.02212.28
5.3.80.0060.02112.26
5.3.70.0040.02012.34
5.3.60.0030.02012.22
5.3.50.0070.01612.24
5.3.40.0030.02012.21
5.3.30.0090.02612.17
5.3.20.0050.03812.14
5.3.10.0050.04211.96
5.3.00.0050.04012.07
5.2.170.0000.03711.11
5.2.160.0030.03010.95
5.2.150.0000.03011.15
5.2.140.0100.06011.12
5.2.130.0000.04011.14
5.2.120.0070.05011.11
5.2.110.0100.04711.07
5.2.100.0130.02711.05
5.2.90.0030.06310.94
5.2.80.0170.05011.05
5.2.70.0070.04310.89
5.2.60.0030.05010.96
5.2.50.0070.03311.06
5.2.40.0100.05710.79
5.2.30.0070.06010.80
5.2.20.0030.03310.94
5.2.10.0030.06010.91
5.2.00.0030.06310.87
5.1.60.0030.02310.03
5.1.50.0030.0479.98
5.1.40.0070.0509.91
5.1.30.0030.03710.34
5.1.20.0070.05710.36
5.1.10.0030.03310.07
5.1.00.0000.03710.07
5.0.50.0000.0408.52
5.0.40.0070.0378.43
5.0.30.0000.0408.39
5.0.20.0070.0408.17
5.0.10.0100.0238.17
5.0.00.0000.0708.16
4.4.90.0100.0207.66
4.4.80.0030.0337.66
4.4.70.0000.0207.66
4.4.60.0030.0337.66
4.4.50.0100.0207.66
4.4.40.0000.0577.66
4.4.30.0070.0307.66
4.4.20.0000.0277.66
4.4.10.0070.0307.66
4.4.00.0000.0507.66
4.3.110.0070.0137.66
4.3.100.0030.0307.66
4.3.90.0000.0307.66
4.3.80.0000.0337.66
4.3.70.0000.0337.66
4.3.60.0030.0237.66
4.3.50.0030.0207.66
4.3.40.0030.0507.66
4.3.30.0030.0237.66
4.3.20.0000.0377.66
4.3.10.0000.0307.66
4.3.00.0000.0377.66

preferences:
53.62 ms | 401 KiB | 5 Q