3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Initial datetimes $date1 = new DateTime('2014-06-25 11:30'); $date2 = new DateTime('2014-07-22 12:30'); // 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.0000.01416.75
8.3.50.0170.00018.49
8.3.40.0150.00619.13
8.3.30.0030.01219.29
8.3.20.0040.00420.16
8.3.10.0050.00323.48
8.3.00.0040.00419.18
8.2.180.0070.01116.88
8.2.170.0120.00922.96
8.2.160.0120.00320.51
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00420.85
8.2.110.0090.00022.37
8.2.100.0080.00418.03
8.2.90.0040.00419.30
8.2.80.0050.00317.97
8.2.70.0040.00417.88
8.2.60.0000.00818.05
8.2.50.0000.00818.07
8.2.40.0080.00021.24
8.2.30.0000.00818.36
8.2.20.0030.00518.08
8.2.10.0020.00518.19
8.2.00.0000.00917.96
8.1.270.0060.00323.89
8.1.260.0050.00326.35
8.1.250.0100.00028.09
8.1.240.0090.00022.12
8.1.230.0080.00319.14
8.1.220.0040.00417.91
8.1.210.0070.00318.77
8.1.200.0030.00717.60
8.1.190.0000.00817.48
8.1.180.0050.00318.10
8.1.170.0000.00818.75
8.1.160.0040.00422.12
8.1.150.0050.00218.88
8.1.140.0040.00417.68
8.1.130.0030.00317.91
8.1.120.0000.00717.79
8.1.110.0000.00717.66
8.1.100.0080.00017.59
8.1.90.0070.00017.66
8.1.80.0040.00417.79
8.1.70.0040.00417.63
8.1.60.0060.00317.82
8.1.50.0000.00717.63
8.1.40.0030.00617.56
8.1.30.0040.00417.89
8.1.20.0080.00017.80
8.1.10.0030.00517.75
8.1.00.0090.00017.65
8.0.300.0040.00418.77
8.0.290.0040.00417.17
8.0.280.0040.00418.51
8.0.270.0060.00317.32
8.0.260.0030.00317.46
8.0.250.0030.00317.12
8.0.240.0000.00817.13
8.0.230.0000.00817.13
8.0.220.0020.00517.11
8.0.210.0000.00717.13
8.0.200.0030.00317.14
8.0.190.0000.00817.22
8.0.180.0040.00417.24
8.0.170.0020.00517.16
8.0.160.0070.00017.24
8.0.150.0000.00917.11
8.0.140.0050.00217.16
8.0.130.0000.00613.54
8.0.120.0060.00317.16
8.0.110.0040.00417.10
8.0.100.0040.00417.16
8.0.90.0000.00817.13
8.0.80.0000.01917.19
8.0.70.0040.00417.13
8.0.60.0000.00717.20
8.0.50.0080.00017.13
8.0.30.0120.00917.23
8.0.20.0170.00917.58
8.0.10.0060.00317.34
8.0.00.0080.01017.06
7.4.330.0000.00515.32
7.4.320.0000.00616.71
7.4.300.0090.00416.77
7.4.290.0080.00016.83
7.4.280.0000.01116.64
7.4.270.0070.00016.88
7.4.260.0070.00316.63
7.4.250.0040.00416.67
7.4.240.0020.00516.86
7.4.230.0050.00216.61
7.4.220.0030.01516.66
7.4.210.0050.01016.75
7.4.200.0070.00016.82
7.4.190.0030.00416.63
7.4.160.0040.01216.62
7.4.150.0200.00017.40
7.4.140.0120.01017.86
7.4.130.0110.00816.66
7.4.120.0140.00316.68
7.4.110.0100.00716.74
7.4.100.0090.00916.63
7.4.90.0070.01116.70
7.4.80.0060.01319.39
7.4.70.0070.01016.57
7.4.60.0140.00316.58
7.4.50.0000.00916.59
7.4.40.0090.00616.86
7.4.30.0040.01216.71
7.4.10.0030.01615.14
7.4.00.0070.01115.09
7.3.330.0000.00613.32
7.3.320.0080.00413.28
7.3.310.0040.00416.53
7.3.300.0030.00316.34
7.3.290.0030.01616.54
7.3.280.0070.01216.50
7.3.270.0110.00517.40
7.3.260.0070.01116.87
7.3.250.0150.00916.54
7.3.240.0070.01016.70
7.3.230.0080.00816.77
7.3.210.0110.00916.74
7.3.200.0070.01019.39
7.3.190.0090.01016.77
7.3.180.0160.00316.74
7.3.170.0120.00616.60
7.3.160.0080.00816.67
7.3.130.0120.00814.97
7.3.120.0080.00815.37
7.3.110.0040.01214.97
7.3.100.0040.00715.15
7.3.90.0070.01015.25
7.3.80.0060.00914.86
7.3.70.0060.00615.01
7.3.60.0110.00415.02
7.3.50.0090.00614.90
7.3.40.0070.00714.98
7.3.30.0060.00914.85
7.3.20.0030.01016.68
7.3.10.0050.01016.75
7.3.00.0080.00416.75
7.2.330.0140.00316.90
7.2.320.0120.00616.67
7.2.310.0060.01216.76
7.2.300.0000.01716.66
7.2.290.0060.01117.01
7.2.260.0130.00615.43
7.2.250.0050.01015.37
7.2.240.0030.01015.47
7.2.230.0000.01515.31
7.2.220.0090.00915.52
7.2.210.0080.00315.59
7.2.200.0030.01215.45
7.2.190.0030.01015.17
7.2.180.0090.00915.48
7.2.170.0080.00915.16
7.2.160.0070.00715.36
7.2.150.0120.00617.16
7.2.140.0080.00817.12
7.2.130.0070.00717.15
7.2.120.0030.01116.99
7.2.110.0030.01017.23
7.2.100.0050.00817.07
7.2.90.0060.00517.27
7.2.80.0050.00817.06
7.2.70.0080.00817.01
7.2.60.0070.00817.13
7.2.50.0070.00717.10
7.2.40.0050.00917.27
7.2.30.0060.00517.19
7.2.20.0020.01217.26
7.2.10.0090.00817.28
7.2.00.0080.00417.09
7.1.330.0070.00715.99
7.1.320.0080.00516.18
7.1.310.0030.00615.80
7.1.300.0000.01415.85
7.1.290.0000.01316.09
7.1.280.0030.01016.14
7.1.270.0040.01116.16
7.1.260.0030.01216.09
7.1.250.0050.00616.15
7.1.240.0070.00715.83
7.1.230.0040.00816.17
7.1.220.0040.01115.88
7.1.210.0070.00716.00
7.1.200.0000.01215.93
7.1.190.0090.00615.99
7.1.180.0100.00616.05
7.1.170.0030.00715.90
7.1.160.0040.00816.08
7.1.150.0120.00616.15
7.1.140.0030.00616.12
7.1.130.0060.00315.90
7.1.120.0090.00615.96
7.1.110.0060.00916.16
7.1.100.0110.00415.93
7.1.90.0000.00915.96
7.1.80.0050.00516.09
7.1.70.0040.00516.82
7.1.60.0050.01317.83
7.1.50.0050.01316.50
7.1.40.0000.01215.99
7.1.30.0100.00615.93
7.1.20.0000.01115.94
7.1.10.0030.00915.97
7.1.00.0060.03819.33
7.0.330.0030.01015.47
7.0.320.0000.00815.55
7.0.310.0100.00315.34
7.0.300.0030.00715.25
7.0.290.0070.00415.59
7.0.280.0000.01115.38
7.0.270.0000.01015.51
7.0.260.0040.00715.63
7.0.250.0090.00615.70
7.0.240.0100.00315.29
7.0.230.0030.00715.57
7.0.220.0040.00715.61
7.0.210.0100.00315.69
7.0.200.0030.00716.25
7.0.190.0060.00315.68
7.0.180.0070.00315.67
7.0.170.0120.00015.43
7.0.160.0040.00815.64
7.0.150.0090.00315.37
7.0.140.0050.03918.77
7.0.130.0060.00615.63
7.0.120.0070.00715.59
7.0.110.0130.00015.67
7.0.100.0060.00615.52
7.0.90.0070.00415.68
7.0.80.0080.00415.62
7.0.70.0110.00415.38
7.0.60.0100.03717.87
7.0.50.0030.03016.68
7.0.40.0100.04316.84
7.0.30.0170.04216.81
7.0.20.0150.03716.72
7.0.10.0070.04416.93
7.0.00.0050.03816.74
5.6.400.0000.01414.68
5.6.390.0030.01014.40
5.6.380.0060.00614.16
5.6.370.0030.00614.68
5.6.360.0000.01214.52
5.6.350.0100.00714.45
5.6.340.0060.00614.19
5.6.330.0060.00914.66
5.6.320.0060.00914.76
5.6.310.0030.00914.48
5.6.300.0030.01014.49
5.6.290.0040.00814.63
5.6.280.0050.04117.91
5.6.270.0060.00914.50
5.6.260.0030.01014.46
5.6.250.0000.00914.43
5.6.240.0080.00414.57
5.6.230.0000.01014.66
5.6.220.0090.00614.47
5.6.210.0080.04017.59
5.6.200.0080.02716.38
5.6.190.0090.03017.44
5.6.180.0080.04617.37
5.6.170.0140.02417.75
5.6.160.0100.04317.48
5.6.150.0070.03716.18
5.6.140.0060.02816.36
5.6.130.0060.04216.43
5.6.120.0070.03317.69
5.6.110.0050.05017.74
5.6.100.0050.02517.82
5.6.90.0070.04317.79
5.6.80.0050.03717.50
5.6.70.0000.01214.20
5.6.60.0000.01514.56
5.6.50.0110.00414.55
5.6.40.0030.00914.54
5.6.30.0090.00614.61
5.6.20.0000.01514.50
5.6.10.0080.00414.78
5.6.00.0030.00614.42
5.5.380.0040.01214.53
5.5.370.0060.00914.61
5.5.360.0040.00714.66
5.5.350.0050.02217.55
5.5.340.0070.02016.16
5.5.330.0080.04217.32
5.5.320.0190.04017.23
5.5.310.0220.04217.31
5.5.300.0030.03216.34
5.5.290.0050.04716.20
5.5.280.0110.02517.60
5.5.270.0080.04417.74
5.5.260.0050.03317.48
5.5.250.0060.04317.35
5.5.240.0050.04117.32
5.5.230.0030.01314.58
5.5.220.0000.01514.45
5.5.210.0000.01714.57
5.5.200.0090.00414.65
5.5.190.0060.00614.36
5.5.180.0030.01314.52
5.5.170.0000.01114.63
5.5.160.0060.00914.32
5.5.150.0040.01114.64
5.5.140.0060.00314.46
5.5.130.0000.00914.31
5.5.120.0100.00314.32
5.5.110.0080.00814.59
5.5.100.0090.00414.62
5.5.90.0060.00614.33
5.5.80.0090.00614.57
5.5.70.0000.00914.04
5.5.60.0030.01014.45
5.5.50.0070.00714.24
5.5.40.0030.00914.53
5.5.30.0080.00814.49
5.5.20.0060.01214.57
5.5.10.0060.01314.38
5.5.00.0040.01514.28
5.4.450.0330.03715.81
5.4.440.0320.03215.73
5.4.430.0430.03016.01
5.4.420.0450.03515.96
5.4.410.0350.03415.85
5.4.400.0510.02915.70
5.4.390.0400.03515.64
5.4.380.0210.03815.43
5.4.370.0260.03115.55
5.4.360.0120.03315.38
5.4.350.0180.03715.46
5.4.340.0150.03315.44
5.4.330.0000.00612.38
5.4.320.0060.02612.42
5.4.310.0070.02112.42
5.4.300.0040.02212.42
5.4.290.0060.02112.42
5.4.280.0050.02912.37
5.4.270.0070.02612.37
5.4.260.0040.02712.37
5.4.250.0050.02412.37
5.4.240.0050.02012.37
5.4.230.0060.02012.37
5.4.220.0050.02212.36
5.4.210.0040.02712.37
5.4.200.0060.02412.36
5.4.190.0020.02412.36
5.4.180.0050.02212.36
5.4.170.0060.02112.37
5.4.160.0070.02312.37
5.4.150.0060.02412.37
5.4.140.0060.02712.21
5.4.130.0080.02112.20
5.4.120.0020.02812.18
5.4.110.0050.02512.18
5.4.100.0070.02812.18
5.4.90.0090.02712.18
5.4.80.0080.02612.18
5.4.70.0090.02712.17
5.4.60.0050.02712.18
5.4.50.0070.02712.18
5.4.40.0090.02512.17
5.4.30.0060.02812.17
5.4.20.0070.02712.17
5.4.10.0080.02612.17
5.4.00.0070.02811.91
5.3.290.0070.02412.59
5.3.280.0050.03112.54
5.3.270.0050.03212.55
5.3.260.0040.03212.55
5.3.250.0050.03012.55
5.3.240.0060.03812.55
5.3.230.0070.03312.54
5.3.220.0080.03012.53
5.3.210.0060.03212.53
5.3.200.0070.03212.53
5.3.190.0070.02612.53
5.3.180.0030.03012.53
5.3.170.0070.03212.53
5.3.160.0050.02912.53
5.3.150.0040.03212.53
5.3.140.0060.02912.52
5.3.130.0050.03212.52
5.3.120.0070.02812.52
5.3.110.0070.02812.52
5.3.100.0050.02812.25
5.3.90.0040.02912.23
5.3.80.0050.02712.22
5.3.70.0050.03212.23
5.3.60.0040.02712.22
5.3.50.0070.02512.19
5.3.40.0070.02312.19
5.3.30.0030.02112.17
5.3.20.0020.02812.06
5.3.10.0020.02312.04
5.3.00.0050.02212.04
5.2.170.0060.0309.20
5.2.160.0080.0429.20
5.2.150.0050.0469.20
5.2.140.0070.0439.20
5.2.130.0030.0359.16
5.2.120.0080.0309.16
5.2.110.0040.0429.16
5.2.100.0050.0329.16
5.2.90.0070.0309.16
5.2.80.0090.0479.16
5.2.70.0090.0609.15
5.2.60.0090.0669.11
5.2.50.0080.0429.08
5.2.40.0040.0439.05
5.2.30.0050.0459.04
5.2.20.0040.0429.02
5.2.10.0050.0408.95
5.2.00.0070.0418.80
5.1.60.0090.0228.08
5.1.50.0030.0288.08
5.1.40.0060.0248.06
5.1.30.0060.0278.41
5.1.20.0060.0298.43
5.1.10.0090.0258.16
5.1.00.0070.0348.16
5.0.50.0060.0266.64
5.0.40.0040.0276.50
5.0.30.0030.0466.31
5.0.20.0070.0256.29
5.0.10.0040.0296.26
5.0.00.0060.0366.25
4.4.90.0050.0254.78
4.4.80.0050.0214.75
4.4.70.0040.0234.76
4.4.60.0060.0204.75
4.4.50.0070.0204.77
4.4.40.0020.0364.71
4.4.30.0020.0214.76
4.4.20.0020.0174.85
4.4.10.0030.0154.85
4.4.00.0010.0264.76
4.3.110.0020.0164.67
4.3.100.0030.0154.67
4.3.90.0020.0164.64
4.3.80.0050.0294.58
4.3.70.0020.0174.63
4.3.60.0030.0204.62
4.3.50.0020.0204.63
4.3.40.0020.0254.54
4.3.30.0010.0163.28
4.3.20.0030.0153.26
4.3.10.0020.0163.22
4.3.00.0130.0207.35

preferences:
52.92 ms | 400 KiB | 5 Q