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-22 12:29:16'); // 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.40.0000.01518.91
8.3.30.0170.00019.09
8.3.20.0030.00520.30
8.3.10.0060.00322.05
8.3.00.0030.00522.48
8.2.170.0110.00422.96
8.2.160.0100.00319.46
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0050.00317.75
8.2.110.0030.00620.64
8.2.100.0060.00617.97
8.2.90.0000.00819.33
8.2.80.0030.00519.79
8.2.70.0080.00017.75
8.2.60.0080.00317.80
8.2.50.0040.00418.07
8.2.40.0040.00418.28
8.2.30.0000.00718.16
8.2.20.0040.00417.92
8.2.10.0040.00419.76
8.2.00.0080.00017.93
8.1.270.0060.01222.25
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.01023.81
8.1.230.0000.01123.88
8.1.220.0040.00417.77
8.1.210.0040.00418.77
8.1.200.0060.00317.47
8.1.190.0000.00917.66
8.1.180.0000.00818.10
8.1.170.0030.00718.90
8.1.160.0040.00421.96
8.1.150.0000.00718.98
8.1.140.0050.00217.57
8.1.130.0000.00718.09
8.1.120.0040.00417.76
8.1.110.0080.00017.63
8.1.100.0050.00317.75
8.1.90.0000.00717.66
8.1.80.0000.00717.81
8.1.70.0000.00917.75
8.1.60.0090.00017.87
8.1.50.0040.00417.79
8.1.40.0030.00517.77
8.1.30.0040.00417.85
8.1.20.0040.00417.70
8.1.10.0000.00817.70
8.1.00.0000.00717.83
8.0.300.0040.00418.77
8.0.290.0080.00017.30
8.0.280.0000.00718.53
8.0.270.0000.00717.43
8.0.260.0070.00017.11
8.0.250.0030.00317.31
8.0.240.0030.00617.11
8.0.230.0070.00017.25
8.0.220.0040.00417.05
8.0.210.0030.00317.05
8.0.200.0040.00417.20
8.0.190.0000.00717.10
8.0.180.0070.00017.24
8.0.170.0040.00417.10
8.0.160.0000.00717.16
8.0.150.0000.00717.13
8.0.140.0000.00817.15
8.0.130.0000.00613.54
8.0.120.0040.00417.20
8.0.110.0050.00317.07
8.0.100.0070.00017.14
8.0.90.0000.00716.98
8.0.80.0040.01417.16
8.0.70.0000.00717.07
8.0.60.0030.00617.20
8.0.50.0070.00017.04
8.0.30.0150.00817.22
8.0.20.0060.01117.40
8.0.10.0040.00417.07
8.0.00.0110.00617.03
7.4.330.0060.00015.00
7.4.320.0060.00016.73
7.4.300.0060.00016.71
7.4.290.0040.00416.71
7.4.280.0000.00716.82
7.4.270.0040.00416.82
7.4.260.0030.00516.82
7.4.250.0040.00416.79
7.4.240.0030.00416.74
7.4.230.0040.00416.85
7.4.220.0090.00616.89
7.4.210.0050.01116.72
7.4.200.0070.00016.89
7.4.190.0000.00716.76
7.4.160.0060.01216.57
7.4.150.0070.01017.40
7.4.140.0130.00917.86
7.4.130.0120.00916.71
7.4.120.0090.00916.65
7.4.110.0120.00916.63
7.4.100.0060.01116.75
7.4.90.0070.01116.84
7.4.80.0040.01319.39
7.4.70.0080.00816.75
7.4.60.0110.00716.63
7.4.50.0030.00616.79
7.4.40.0030.01222.77
7.4.30.0100.00716.85
7.4.10.0090.00915.02
7.4.00.0030.01415.18
7.3.330.0040.00413.29
7.3.320.0050.00013.31
7.3.310.0000.00716.28
7.3.300.0000.00716.38
7.3.290.0040.01016.42
7.3.280.0090.00716.40
7.3.270.0090.00917.40
7.3.260.0130.00616.47
7.3.250.0020.01616.67
7.3.240.0070.01016.89
7.3.230.0130.00716.56
7.3.210.0070.01016.50
7.3.200.0090.01219.39
7.3.190.0170.00016.46
7.3.180.0090.00616.59
7.3.170.0060.00916.73
7.3.160.0060.01016.41
7.3.130.0030.01415.32
7.3.120.0070.00915.13
7.3.110.0160.00015.10
7.3.100.0120.00314.95
7.3.90.0060.00614.79
7.3.80.0030.00614.97
7.3.70.0000.01415.09
7.3.60.0060.00914.97
7.3.50.0030.01014.70
7.3.40.0070.00715.02
7.3.30.0000.01515.03
7.3.20.0060.00616.82
7.3.10.0070.00416.73
7.3.00.0090.00516.62
7.2.330.0130.00316.63
7.2.320.0140.01116.77
7.2.310.0100.01316.79
7.2.300.0040.01516.66
7.2.290.0100.01016.79
7.2.260.0030.01515.26
7.2.250.0080.01115.14
7.2.240.0030.01415.43
7.2.230.0040.01215.23
7.2.220.0110.00415.47
7.2.210.0070.00715.26
7.2.200.0030.01214.91
7.2.190.0060.00615.41
7.2.180.0000.01415.39
7.2.170.0100.00714.99
7.2.160.0100.00615.29
7.2.150.0080.00417.23
7.2.140.0000.01017.21
7.2.130.0130.00316.84
7.2.120.0090.00916.85
7.2.110.0120.01016.82
7.2.100.0100.00616.88
7.2.90.0100.00816.94
7.2.80.0120.00816.89
7.2.70.0090.01117.07
7.2.60.0090.00616.99
7.2.50.0090.01116.91
7.2.40.0120.00816.82
7.2.30.0110.00916.77
7.2.20.0120.00916.86
7.2.10.0100.01116.92
7.2.00.0050.00817.92
7.1.330.0110.00415.65
7.1.320.0120.00315.80
7.1.310.0060.01016.04
7.1.300.0080.00315.75
7.1.290.0070.00715.88
7.1.280.0100.00315.77
7.1.270.0040.00715.90
7.1.260.0080.00416.13
7.1.250.0110.00615.90
7.1.240.0100.00715.90
7.1.230.0040.00415.70
7.1.220.0070.00415.59
7.1.210.0040.00716.16
7.1.200.0030.01315.93
7.1.190.0060.00616.12
7.1.180.0030.00715.97
7.1.170.0040.01115.93
7.1.160.0030.01016.11
7.1.150.0110.00016.08
7.1.140.0070.00716.03
7.1.130.0000.00816.08
7.1.120.0030.00915.66
7.1.110.0040.00415.85
7.1.100.0040.00817.18
7.1.90.0090.00616.01
7.1.80.0110.00416.06
7.1.70.0050.00616.62
7.1.60.0080.00917.93
7.1.50.0120.00716.37
7.1.40.0120.00615.58
7.1.30.0060.00916.10
7.1.20.0090.00916.08
7.1.10.0090.00615.88
7.1.00.0000.04619.11
7.0.330.0040.01115.64
7.0.320.0040.00715.59
7.0.310.0030.00615.69
7.0.300.0000.01115.65
7.0.290.0070.00715.44
7.0.280.0100.00015.36
7.0.270.0030.00615.61
7.0.260.0070.00715.67
7.0.250.0030.00615.70
7.0.240.0090.00015.76
7.0.230.0100.00715.43
7.0.220.0060.00615.63
7.0.210.0050.00515.37
7.0.200.0070.00616.24
7.0.190.0060.00315.65
7.0.180.0070.00715.56
7.0.170.0030.00915.83
7.0.160.0070.00715.67
7.0.150.0090.00315.63
7.0.140.0050.04018.88
7.0.130.0080.00815.62
7.0.120.0040.00815.26
7.0.110.0040.00815.64
7.0.100.0030.00615.54
7.0.90.0060.00615.59
7.0.80.0070.00715.54
7.0.70.0080.01318.69
7.0.60.0040.03918.70
7.0.50.0030.02918.88
7.0.40.0000.04916.89
7.0.30.0050.04316.79
7.0.20.0040.04616.90
7.0.10.0070.04416.77
7.0.00.0090.02716.87
5.6.400.0070.00714.63
5.6.390.0060.01014.49
5.6.380.0070.00714.59
5.6.370.0090.00614.32
5.6.360.0000.01714.54
5.6.350.0150.00014.94
5.6.340.0000.01314.78
5.6.330.0070.00314.51
5.6.320.0070.00414.33
5.6.310.0030.01014.49
5.6.300.0060.00314.33
5.6.290.0100.00614.82
5.6.280.0060.03817.80
5.6.270.0060.00614.96
5.6.260.0060.00614.35
5.6.250.0050.00514.60
5.6.240.0000.01714.27
5.6.230.0040.01114.61
5.6.220.0070.04317.58
5.6.210.0050.04117.45
5.6.200.0030.04617.68
5.6.190.0050.03317.66
5.6.180.0060.04617.78
5.6.170.0110.02117.65
5.6.160.0070.04017.80
5.6.150.0050.03517.72
5.6.140.0060.03817.86
5.6.130.0070.04417.85
5.6.120.0050.03217.82
5.6.110.0020.03217.87
5.6.100.0080.04117.68
5.6.90.0050.04217.76
5.6.80.0040.04617.48
5.6.70.0090.03717.58
5.6.60.0050.02317.53
5.6.50.0070.03717.52
5.6.40.0070.02117.49
5.6.30.0060.02617.28
5.6.20.0090.02517.31
5.6.10.0110.02117.40
5.6.00.0090.03217.33
5.5.380.0030.00914.74
5.5.370.0110.00014.17
5.5.360.0000.04617.34
5.5.350.0060.02717.58
5.5.340.0030.03817.69
5.5.330.0000.04817.62
5.5.320.0060.02717.62
5.5.310.0070.02117.43
5.5.300.0050.04217.74
5.5.290.0050.04217.71
5.5.280.0040.04617.59
5.5.270.0110.04017.76
5.5.260.0070.04317.52
5.5.250.0040.04517.56
5.5.240.0070.04117.44
5.5.230.0080.04017.29
5.5.220.0060.04317.14
5.5.210.0050.02717.21
5.5.200.0000.02717.34
5.5.190.0100.04217.35
5.5.180.0020.02717.21
5.5.170.0040.00414.08
5.5.160.0060.04517.36
5.5.150.0050.04617.29
5.5.140.0050.03517.35
5.5.130.0050.04617.35
5.5.120.0060.03017.36
5.5.110.0070.03717.28
5.5.100.0020.04617.38
5.5.90.0020.03716.99
5.5.80.0050.04017.23
5.5.70.0050.04617.18
5.5.60.0050.03017.28
5.5.50.0020.03217.36
5.5.40.0060.04316.97
5.5.30.0080.04117.15
5.5.20.0040.02717.24
5.5.10.0020.04917.08
5.5.00.0050.04117.04
5.4.450.0030.04215.24
5.4.440.0080.03715.26
5.4.430.0030.04615.31
5.4.420.0040.04015.18
5.4.410.0070.02715.38
5.4.400.0060.03015.10
5.4.390.0080.04315.08
5.4.380.0010.02715.22
5.4.370.0020.02715.05
5.4.360.0020.02815.24
5.4.350.0070.03115.13
5.4.340.0050.03114.94
5.4.330.0050.00511.15
5.4.320.0000.04815.11
5.4.310.0030.04014.84
5.4.300.0080.03415.12
5.4.290.0050.03814.99
5.4.280.0050.03815.09
5.4.270.0000.04615.26
5.4.260.0060.04015.13
5.4.250.0040.02515.02
5.4.240.0030.03215.07
5.4.230.0030.03815.04
5.4.220.0020.04214.97
5.4.210.0040.04115.03
5.4.200.0020.04514.91
5.4.190.0070.03314.93
5.4.180.0070.02715.04
5.4.170.0020.04115.24
5.4.160.0030.03315.23
5.4.150.0030.04315.03
5.4.140.0050.03913.91
5.4.130.0060.02513.82
5.4.120.0070.03913.96
5.4.110.0020.04313.72
5.4.100.0070.03813.81
5.4.90.0030.03513.88
5.4.80.0030.03013.61
5.4.70.0020.04313.74
5.4.60.0050.03513.79
5.4.50.0080.03613.70
5.4.40.0020.02513.85
5.4.30.0020.04213.58
5.4.20.0050.03713.78
5.4.10.0030.02513.82
5.4.00.0040.03813.45
5.3.290.0030.02912.72
5.3.280.0040.03112.59
5.3.270.0060.02712.71
5.3.260.0050.03312.64
5.3.250.0040.02812.50
5.3.240.0030.04012.66
5.3.230.0030.02712.65
5.3.220.0030.04012.57
5.3.210.0060.03712.44
5.3.200.0030.03812.54
5.3.190.0040.03112.44
5.3.180.0020.04212.56
5.3.170.0000.04512.56
5.3.160.0010.04312.62
5.3.150.0060.03512.56
5.3.140.0030.02512.59
5.3.130.0020.04212.63
5.3.120.0040.03512.53
5.3.110.0020.03512.64
5.3.100.0020.02812.36
5.3.90.0030.03712.37
5.3.80.0030.03812.26
5.3.70.0070.03612.28
5.3.60.0050.03412.28
5.3.50.0030.03812.29
5.3.40.0040.04112.27
5.3.30.0020.04312.17
5.3.20.0030.04212.13
5.3.10.0020.04111.89
5.3.00.0000.02612.01
5.2.170.0000.05011.22
5.2.160.0070.06011.22
5.2.150.0000.06711.15
5.2.140.0030.06011.11
5.2.130.0000.05310.97
5.2.120.0000.04310.91
5.2.110.0000.04711.18
5.2.100.0030.06010.96
5.2.90.0000.03710.96
5.2.80.0030.06011.06
5.2.70.0000.07011.07
5.2.60.0000.06311.08
5.2.50.0030.05710.88
5.2.40.0100.04711.00
5.2.30.0000.05710.99
5.2.20.0030.06010.96
5.2.10.0070.04710.77
5.2.00.0000.06310.58
5.1.60.0070.04310.30
5.1.50.0030.04710.30
5.1.40.0070.05010.30
5.1.30.0070.05310.30
5.1.20.0070.05310.39
5.1.10.0100.04010.30
5.1.00.0070.03710.30
5.0.50.0000.04710.30
5.0.40.0030.03710.30
5.0.30.0070.03710.30
5.0.20.0030.04310.30
5.0.10.0030.04010.30
5.0.00.0070.06310.30
4.4.90.0000.04010.30
4.4.80.0000.03010.30
4.4.70.0030.03310.30
4.4.60.0030.03310.30
4.4.50.0000.02710.30
4.4.40.0000.05310.30
4.4.30.0030.02310.30
4.4.20.0000.03710.30
4.4.10.0000.03710.30
4.4.00.0030.05010.30
4.3.110.0030.03310.30
4.3.100.0000.02710.30
4.3.90.0030.03010.30
4.3.80.0000.05310.30
4.3.70.0000.03310.30
4.3.60.0000.03710.30
4.3.50.0070.02710.30
4.3.40.0000.05710.30
4.3.30.0070.03010.30
4.3.20.0000.03010.30
4.3.10.0030.03310.30
4.3.00.0000.03710.30

preferences:
36.75 ms | 400 KiB | 5 Q