3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 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++; } } print "<pre>"; print_r($period); print "</pre>"; // 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.01116.88
8.3.50.0130.00922.11
8.3.40.0090.00619.10
8.3.30.0060.00919.09
8.3.20.0040.00420.33
8.3.10.0040.00423.51
8.3.00.0080.00019.38
8.2.180.0100.01016.63
8.2.170.0110.00722.96
8.2.160.0070.00720.47
8.2.150.0030.00524.18
8.2.140.0050.00224.66
8.2.130.0040.00426.16
8.2.120.0060.00317.75
8.2.110.0000.00920.56
8.2.100.0040.00818.16
8.2.90.0090.00019.48
8.2.80.0050.00318.00
8.2.70.0030.00617.88
8.2.60.0000.00818.18
8.2.50.0030.00518.07
8.2.40.0000.00819.41
8.2.30.0000.00720.64
8.2.20.0040.00417.95
8.2.10.0040.00418.27
8.2.00.0070.00018.40
8.1.280.0120.00925.92
8.1.270.0060.00323.97
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0030.00723.91
8.1.230.0090.00322.75
8.1.220.0040.00417.78
8.1.210.0000.00818.77
8.1.200.0100.00017.47
8.1.190.0060.00617.35
8.1.180.0000.01018.10
8.1.170.0060.00318.82
8.1.160.0040.00422.10
8.1.150.0030.00520.79
8.1.140.0040.00419.65
8.1.130.0040.00417.77
8.1.120.0030.00517.74
8.1.110.0040.00417.72
8.1.100.0080.00317.66
8.1.90.0040.00417.74
8.1.80.0060.00317.59
8.1.70.0020.00517.68
8.1.60.0080.00017.71
8.1.50.0030.00617.65
8.1.40.0070.00417.72
8.1.30.0030.00517.77
8.1.20.0030.00517.86
8.1.10.0040.00417.80
8.1.00.0060.00317.68
8.0.300.0060.00318.77
8.0.290.0000.00817.00
8.0.280.0030.00318.54
8.0.270.0080.00017.43
8.0.260.0030.00317.33
8.0.250.0080.00017.16
8.0.240.0050.00217.20
8.0.230.0050.00317.24
8.0.220.0030.00717.18
8.0.210.0000.00717.16
8.0.200.0030.00317.30
8.0.190.0080.00017.32
8.0.180.0030.00617.23
8.0.170.0000.00817.04
8.0.160.0030.00417.14
8.0.150.0000.00817.03
8.0.140.0070.00017.13
8.0.130.0050.00013.55
8.0.120.0000.00817.11
8.0.110.0000.00817.22
8.0.100.0040.00417.24
8.0.90.0000.00717.05
8.0.80.0070.00717.16
8.0.70.0030.00517.28
8.0.60.0000.00717.22
8.0.50.0000.00717.04
8.0.30.0080.00917.31
8.0.20.0090.01217.43
8.0.10.0000.00817.29
8.0.00.0110.00817.20
7.4.330.0000.00515.08
7.4.320.0060.00016.72
7.4.300.0000.00616.81
7.4.290.0030.00316.72
7.4.280.0000.00816.83
7.4.270.0070.00016.81
7.4.260.0040.00416.70
7.4.250.0000.00816.69
7.4.240.0040.00416.78
7.4.230.0000.00716.85
7.4.220.0060.01316.73
7.4.210.0050.01016.86
7.4.200.0040.00316.59
7.4.160.0160.00316.70
7.4.150.0090.00917.40
7.4.140.0130.00917.86
7.4.130.0140.00616.70
7.4.120.0110.00616.82
7.4.110.0090.00916.82
7.4.100.0130.01316.84
7.4.90.0130.01016.66
7.4.80.0100.01019.39
7.4.70.0080.00816.73
7.4.60.0080.00816.73
7.4.50.0000.00816.72
7.4.40.0030.01416.89
7.4.30.0030.01916.71
7.4.00.0080.00815.07
7.3.330.0030.00313.32
7.3.320.0000.00513.41
7.3.310.0030.00316.48
7.3.300.0030.00316.50
7.3.290.0070.00016.46
7.3.280.0100.00916.54
7.3.270.0060.01117.40
7.3.260.0080.00816.77
7.3.250.0110.00616.55
7.3.240.0120.00816.51
7.3.230.0100.00716.52
7.3.210.0080.00816.83
7.3.200.0070.01016.76
7.3.190.0030.01316.62
7.3.180.0080.00816.85
7.3.170.0040.01516.61
7.3.160.0100.00616.60
7.3.00.0030.01016.87
7.2.330.0120.00616.91
7.2.320.0060.01216.75
7.2.310.0040.01316.86
7.2.300.0150.00617.07
7.2.290.0140.00916.84
7.2.130.0070.00717.27
7.2.120.0030.00617.00
7.2.110.0080.00417.21
7.2.100.0090.00017.19
7.2.90.0070.00717.20
7.2.80.0040.01117.17
7.2.70.0060.01017.16
7.2.60.0080.00817.20
7.2.50.0000.01316.99
7.2.40.0040.01116.95
7.2.30.0070.01317.19
7.2.20.0040.01217.22
7.2.10.0100.00716.88
7.2.00.0030.00818.54
7.1.250.0030.01416.12
7.1.240.0070.00716.03
7.1.230.0060.01216.11
7.1.220.0080.00815.95
7.1.210.0060.00315.89
7.1.200.0030.00816.00
7.1.190.0060.00615.81
7.1.180.0030.01016.10
7.1.170.0060.00616.11
7.1.160.0120.00316.11
7.1.150.0080.00316.07
7.1.140.0070.00615.85
7.1.130.0050.00515.82
7.1.120.0030.01215.74
7.1.110.0030.00616.19
7.1.100.0070.00517.21
7.1.90.0120.00316.14
7.1.80.0060.00616.16
7.1.70.0020.01016.67
7.1.60.0050.01417.76
7.1.50.0020.01116.27
7.1.40.0070.00415.96
7.1.30.0090.00015.73
7.1.20.0060.00316.10
7.1.10.0090.00416.05
7.1.00.0030.04119.11
7.0.330.0060.00615.65
7.0.320.0110.00015.53
7.0.310.0040.00815.47
7.0.300.0120.00415.60
7.0.290.0060.00315.15
7.0.280.0120.00315.56
7.0.270.0060.00615.30
7.0.260.0100.00715.46
7.0.250.0120.00315.26
7.0.240.0070.00715.67
7.0.230.0000.01215.56
7.0.220.0030.00815.31
7.0.210.0090.00615.54
7.0.200.0060.00815.23
7.0.190.0150.00015.64
7.0.180.0070.00715.32
7.0.170.0100.00315.18
7.0.160.0120.00015.26
7.0.150.0060.00615.22
7.0.140.0070.00715.53
7.0.130.0000.01415.63
7.0.120.0080.00815.41
7.0.110.0070.00715.63
7.0.100.0160.00415.37
7.0.90.0070.01015.66
7.0.80.0000.01215.53
7.0.70.0100.00715.50
7.0.60.0050.02517.64
7.0.50.0020.04916.75
7.0.40.0070.02316.85
7.0.30.0170.04216.83
7.0.20.0150.02716.86
7.0.10.0070.04916.89
7.0.00.0100.03516.75
5.6.380.0090.00414.82
5.6.370.0110.00014.52
5.6.360.0030.00614.18
5.6.350.0120.00314.33
5.6.340.0070.00414.30
5.6.330.0090.00614.30
5.6.320.0040.01314.50
5.6.310.0000.01614.77
5.6.300.0100.00714.09
5.6.290.0000.01414.54
5.6.280.0020.02217.80
5.6.270.0110.00414.48
5.6.260.0090.00014.66
5.6.250.0000.00914.50
5.6.240.0030.01414.51
5.6.230.0040.00814.62
5.6.220.0060.00314.64
5.6.210.0030.04817.50
5.6.200.0070.04716.41
5.6.190.0090.02217.55
5.6.180.0260.04017.47
5.6.170.0180.04417.55
5.6.160.0110.04717.58
5.6.150.0070.04516.36
5.6.140.0030.04116.27
5.6.130.0110.02516.31
5.6.120.0100.04517.67
5.6.110.0120.03817.82
5.6.100.0110.03717.67
5.6.90.0030.03017.89
5.6.80.0070.02417.32
5.6.70.0130.00014.18
5.6.60.0120.00314.55
5.6.50.0040.01214.60
5.6.40.0060.00614.38
5.6.30.0110.00414.36
5.6.20.0000.01214.52
5.6.10.0070.00414.47
5.6.00.0040.00714.22
5.5.380.0040.01111.44
5.5.370.0090.00611.18
5.5.360.0080.00011.20
5.5.350.2140.02115.81
5.5.340.0030.04514.58
5.5.330.0060.04615.79
5.5.320.0120.02715.84
5.5.310.0220.02415.78
5.5.300.0050.03714.56
5.5.290.0080.04014.66
5.5.280.0070.04315.90
5.5.270.0020.03515.87
5.5.260.0090.02015.97
5.5.250.0050.02415.94
5.5.240.0060.04015.69
5.5.230.0060.00711.18
5.5.220.0060.00611.00
5.5.210.0060.00311.00
5.5.200.0050.00511.28
5.5.190.0080.00411.00
5.5.180.0050.00511.33
5.5.170.0040.00411.27
5.5.160.0030.00811.24
5.5.150.0040.00811.35
5.5.140.0040.00811.30
5.5.130.0030.01011.27
5.5.120.0070.00411.06
5.5.110.0090.00011.00
5.5.100.0070.00211.34
5.5.90.0090.00011.00
5.5.80.0110.00011.00
5.5.70.0090.00311.00
5.5.60.0070.00711.13
5.5.50.0000.01211.00
5.5.40.0030.00911.00
5.5.30.0050.00811.25
5.5.20.0000.00911.01
5.5.10.0060.00611.09
5.5.00.0080.00011.00
5.4.450.0160.03315.43
5.4.440.0150.03215.38
5.4.430.0150.03815.17
5.4.420.0110.03215.17
5.4.410.0120.03615.20
5.4.400.0060.04015.07
5.4.390.0170.04014.96
5.4.380.0190.03015.14
5.4.370.0200.03214.88
5.4.360.0470.03415.17
5.4.350.0420.03314.90
5.4.340.0410.03015.19
5.4.330.0130.00011.10
5.4.320.0500.03215.08
5.4.310.0540.03215.18
5.4.300.0520.02315.13
5.4.290.0460.03315.08
5.4.280.0480.03315.14
5.4.270.0300.03415.13
5.4.260.0390.02515.07
5.4.250.0490.03015.12
5.4.240.0400.04315.04
5.4.230.0470.03615.17
5.4.220.0460.03315.12
5.4.210.0460.02615.09
5.4.200.0360.03915.10
5.4.190.0580.03215.16
5.4.180.0310.03814.86
5.4.170.0180.04815.15
5.4.160.0150.02715.06
5.4.150.0050.03714.97
5.4.140.0170.02813.74
5.4.130.0120.02913.74
5.4.120.0090.03213.65
5.4.110.0100.03113.83
5.4.100.0170.03513.86
5.4.90.0170.03013.85
5.4.80.0160.03113.79
5.4.70.0050.03513.86
5.4.60.0090.02913.70
5.4.50.0070.03213.76
5.4.40.0150.02713.56
5.4.30.0290.03213.75
5.4.20.0070.03013.79
5.4.10.0110.03113.61
5.4.00.0150.03013.53

preferences:
58.08 ms | 401 KiB | 5 Q