3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Initial datetimes $date1 = new DateTime('2012-03-24 11:29:16'); $date2 = new DateTime('2012-03-24 15: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.70.0150.00618.43
8.3.60.0120.00418.66
8.3.50.0060.00918.38
8.3.40.0030.01319.00
8.3.30.0110.00418.96
8.3.20.0050.00319.46
8.3.10.0090.00021.71
8.3.00.0080.00020.65
8.2.180.0140.00418.43
8.2.170.0120.00322.96
8.2.160.0070.00720.30
8.2.150.0090.00024.18
8.2.140.0040.00424.66
8.2.130.0030.00618.16
8.2.120.0080.00026.35
8.2.110.0100.00019.33
8.2.100.0110.00018.34
8.2.90.0040.00418.13
8.2.80.0080.00018.00
8.2.70.0040.00418.05
8.2.60.0040.00418.41
8.2.50.0030.00518.10
8.2.40.0000.00819.45
8.2.30.0040.00419.52
8.2.20.0040.00418.18
8.2.10.0040.00418.28
8.2.00.0090.00017.87
8.1.280.0120.00625.92
8.1.270.0000.00818.95
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0000.00922.25
8.1.230.0140.00319.15
8.1.220.0030.00517.80
8.1.210.0060.00318.77
8.1.200.0030.00717.48
8.1.190.0030.00617.48
8.1.180.0040.00418.10
8.1.170.0050.00318.75
8.1.160.0000.01019.08
8.1.150.0000.00718.99
8.1.140.0040.00422.27
8.1.130.0000.00722.19
8.1.120.0040.00417.79
8.1.110.0040.00417.79
8.1.100.0000.00717.75
8.1.90.0000.00717.78
8.1.80.0050.00217.63
8.1.70.0000.00817.67
8.1.60.0080.00017.69
8.1.50.0040.00417.75
8.1.40.0040.00417.76
8.1.30.0000.00817.87
8.1.20.0000.00717.72
8.1.10.0000.00817.77
8.1.00.0050.00317.68
8.0.300.0000.00818.77
8.0.290.0050.00316.88
8.0.280.0070.00018.59
8.0.270.0070.00017.43
8.0.260.0030.00318.59
8.0.250.0000.00717.11
8.0.240.0050.00317.28
8.0.230.0000.00717.15
8.0.220.0000.00817.13
8.0.210.0000.00717.20
8.0.200.0000.00817.16
8.0.190.0040.00417.07
8.0.180.0060.00317.13
8.0.170.0000.01017.05
8.0.160.0080.00017.15
8.0.150.0000.00717.14
8.0.140.0000.00717.00
8.0.130.0000.00613.50
8.0.120.0030.00517.03
8.0.110.0050.00317.07
8.0.100.0030.00417.03
8.0.90.0040.00417.14
8.0.80.0040.01417.20
8.0.70.0000.00817.05
8.0.60.0070.00017.05
8.0.50.0000.00817.20
8.0.30.0060.01217.50
8.0.20.0160.00317.40
8.0.10.0000.00717.19
8.0.00.0100.01217.07
7.4.330.0050.00015.55
7.4.320.0030.00316.77
7.4.300.0040.00416.79
7.4.290.0000.00716.73
7.4.280.0080.00216.74
7.4.270.0030.00316.73
7.4.260.0030.00616.64
7.4.250.0040.00416.59
7.4.240.0080.00016.68
7.4.230.0000.00816.80
7.4.220.0000.00716.80
7.4.210.0070.00816.82
7.4.200.0040.00416.80
7.4.160.0100.00716.74
7.4.140.0110.00617.86
7.4.130.0090.00916.72
7.4.120.0130.00816.71
7.4.110.0030.01516.80
7.4.100.0090.00916.83
7.4.90.0140.00316.62
7.4.80.0100.00919.39
7.4.70.0070.01016.91
7.4.60.0090.00916.76
7.4.50.0040.01116.49
7.4.40.0100.00616.55
7.4.00.0070.01115.21
7.3.330.0000.00513.22
7.3.320.0060.00013.25
7.3.310.0000.00916.49
7.3.300.0030.00316.32
7.3.290.0060.00016.26
7.3.280.0100.00416.37
7.3.260.0130.00616.59
7.3.240.0150.00516.63
7.3.230.0100.00716.42
7.3.210.0070.01016.54
7.3.200.0100.00716.96
7.3.190.0030.01516.79
7.3.180.0120.00616.68
7.3.170.0060.01816.61
7.3.160.0070.01016.64
7.3.120.0040.01515.25
7.3.110.0070.01115.00
7.3.100.0030.00714.82
7.3.90.0030.00914.85
7.3.80.0060.00314.93
7.3.70.0030.00714.83
7.3.60.0030.01015.05
7.3.50.0070.01014.70
7.3.40.0040.01115.05
7.3.30.0030.01014.73
7.3.20.0060.00616.78
7.3.10.0100.00316.54
7.3.00.0100.00616.69
7.2.330.0070.01016.96
7.2.320.0060.01216.61
7.2.310.0070.01016.80
7.2.300.0090.00817.08
7.2.290.0080.01216.86
7.2.250.0040.01415.54
7.2.240.0140.00715.02
7.2.230.0000.01015.25
7.2.220.0120.00015.21
7.2.210.0110.00715.36
7.2.200.0040.01115.34
7.2.190.0100.00315.14
7.2.180.0100.00315.25
7.2.170.0070.00715.29
7.2.130.0150.00816.72
7.2.120.0160.00317.04
7.2.110.0270.00615.98
7.2.100.0180.01416.07
7.2.90.0350.00515.97
7.2.80.0250.00616.01
7.2.70.0260.00716.10
7.2.60.0250.00816.03
7.2.50.0300.00315.88
7.2.40.0250.00816.27
7.2.30.0290.00616.15
7.2.20.0300.00415.90
7.2.10.0260.00516.12
7.2.00.0190.00816.02
7.1.330.0060.00815.93
7.1.320.0030.01015.95
7.1.310.0030.00716.02
7.1.300.0070.01015.58
7.1.290.0030.01516.09
7.1.280.0060.00616.01
7.1.270.0060.00915.95
7.1.260.0050.00816.02
7.1.250.0100.00415.64
7.1.240.0100.01015.71
7.1.230.0280.00614.88
7.1.220.0240.00714.81
7.1.210.0220.01114.91
7.1.200.0260.00514.93
7.1.190.0210.00614.77
7.1.180.0190.01014.95
7.1.170.0320.00915.09
7.1.160.0170.01114.73
7.1.150.0240.00614.86
7.1.140.0230.00615.05
7.1.130.0290.00814.95
7.1.120.0250.00114.85
7.1.110.0220.00915.00
7.1.100.0430.00314.91
7.1.90.0190.00914.91
7.1.80.0230.00615.00
7.1.70.0190.00914.83
7.1.60.0290.00923.74
7.1.50.0300.01023.98
7.1.40.0360.00823.93
7.1.30.0440.00523.69
7.1.20.0430.00423.97
7.1.10.0310.00614.89
7.1.00.0300.00514.98
7.0.330.0110.00615.18
5.6.380.0140.00314.50

preferences:
54.5 ms | 401 KiB | 5 Q