3v4l.org

run code in 300+ PHP versions simultaneously
<?php function work_days_between_two_dates(\DateTime $begin, \DateTime $end) { $workdays = []; $all_days = new DatePeriod($begin, new DateInterval('P1D'), $end->modify('+1 day')); foreach ($all_days as $day) { $dow = (int)$day->format('w'); $dom = (int)$day->format('j'); if (1 <= $dow && $dow <= 5) { // Mon - Fri $workdays[] = $day; } else if (6 == $dow && 0 == $dom % 2) { // Even Saturday $workdays[] = $day; } } return $workdays; } $begin = new \DateTime('2015-11-01'); $end = new \DateTime('2015-11-14'); $days = work_days_between_two_dates($begin, $end); foreach ($days as $day) { echo $day->format('Y-m-d') . PHP_EOL; }

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.4.20.0180.00317.98
8.4.10.0060.00317.87
8.3.150.0070.01017.24
8.3.140.0040.00416.83
8.3.130.0060.00318.63
8.3.120.0090.00318.96
8.3.110.0060.00320.94
8.3.100.0030.00716.67
8.3.90.0030.00526.77
8.3.80.0100.00016.87
8.3.70.0070.01516.75
8.3.60.0040.01116.88
8.3.50.0160.00522.24
8.3.40.0000.01518.90
8.3.30.0110.00419.10
8.3.20.0050.00320.20
8.3.10.0060.00323.66
8.3.00.0080.00019.51
8.2.270.0070.00717.42
8.2.260.0040.01120.79
8.2.250.0110.00717.68
8.2.240.0090.00017.55
8.2.230.0060.00322.58
8.2.220.0030.00624.06
8.2.210.0030.00626.77
8.2.200.0050.00518.79
8.2.190.0140.00716.75
8.2.180.0070.01425.92
8.2.170.0070.01119.08
8.2.160.0070.01120.52
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0030.00620.02
8.2.110.0030.00621.19
8.2.100.0120.00018.16
8.2.90.0040.00420.54
8.2.80.0040.00418.05
8.2.70.0030.00918.05
8.2.60.0030.00518.27
8.2.50.0000.00818.10
8.2.40.0050.00319.56
8.2.30.0030.00620.70
8.2.20.0060.00317.94
8.2.10.0040.00418.27
8.2.00.0050.00318.32
8.1.310.0040.00416.84
8.1.300.0090.00316.61
8.1.290.0090.00330.84
8.1.280.0120.00625.92
8.1.270.0060.00322.27
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0060.00319.71
8.1.230.0040.00720.96
8.1.220.0030.00617.91
8.1.210.0060.00318.92
8.1.200.0050.00317.48
8.1.190.0040.00417.38
8.1.180.0030.00518.10
8.1.170.0000.00818.71
8.1.160.0040.00422.09
8.1.150.0070.00019.03
8.1.140.0030.00519.65
8.1.130.0000.00717.84
8.1.120.0070.00017.77
8.1.110.0000.00817.79
8.1.100.0000.00817.61
8.1.90.0080.00017.57
8.1.80.0040.00417.61
8.1.70.0030.00317.73
8.1.60.0000.00817.67
8.1.50.0000.00817.68
8.1.40.0040.00417.74
8.1.30.0050.00317.87
8.1.20.0040.00417.89
8.1.10.0030.00617.81
8.1.00.0000.00817.63
8.0.300.0030.00620.11
8.0.290.0000.00816.88
8.0.280.0040.00418.65
8.0.270.0040.00417.08
8.0.260.0000.00617.33
8.0.250.0070.00017.26
8.0.240.0070.00017.30
8.0.230.0060.00317.26
8.0.220.0000.00717.30
8.0.210.0060.00617.25
8.0.200.0070.00017.29
8.0.190.0060.00317.18
8.0.180.0000.00817.26
8.0.170.0040.00417.14
8.0.160.0050.00317.27
8.0.150.0040.00417.18
8.0.140.0050.00317.14
8.0.130.0000.00613.56
8.0.120.0040.00417.21
8.0.110.0050.00317.17
8.0.100.0040.00417.14
8.0.90.0000.00717.14
8.0.80.0090.00617.19
8.0.70.0040.00417.11
8.0.60.0000.00717.09
8.0.50.0070.00017.19
8.0.30.0100.01017.28
8.0.20.0110.00717.43
8.0.10.0070.00017.15
8.0.00.0100.01116.96
7.4.330.0050.00016.77
7.4.320.0030.00316.68
7.4.300.0000.00616.74
7.4.290.0070.00016.84
7.4.280.0000.00816.63
7.4.270.0030.00316.87
7.4.260.0070.00016.77
7.4.250.0000.00716.78
7.4.240.0070.00016.78
7.4.230.0000.00716.84
7.4.220.0110.00616.77
7.4.210.0080.00816.67
7.4.200.0070.00016.47
7.4.160.0060.00916.83
7.4.150.0050.01417.40
7.4.140.0090.01117.86
7.4.130.0060.01016.84
7.4.120.0060.01416.88
7.4.110.0120.00916.76
7.4.100.0180.00616.56
7.4.90.0090.00916.95
7.4.80.0150.00619.39
7.4.70.0030.01716.77
7.4.60.0030.01416.76
7.4.50.0100.00316.50
7.4.40.0000.01816.67
7.4.30.0130.01016.79
7.4.00.0100.00315.35
7.3.330.0030.00313.41
7.3.320.0030.00313.43
7.3.310.0070.00016.49
7.3.300.0030.00316.46
7.3.290.0110.00416.50
7.3.280.0130.00516.51
7.3.270.0090.00917.40
7.3.260.0120.00616.88
7.3.250.0120.00816.61
7.3.240.0150.00616.59
7.3.230.0100.01016.70
7.3.210.0070.01116.44
7.3.200.0060.01216.89
7.3.190.0130.01016.63
7.3.180.0060.01216.66
7.3.170.0080.00816.71
7.3.160.0130.00316.60
7.3.10.0100.00316.88
7.3.00.0030.01016.76
7.2.330.0100.01016.82
7.2.320.0090.00916.92
7.2.310.0100.00616.87
7.2.300.0100.00717.19
7.2.290.0060.01516.70
7.2.130.0060.00817.24
7.2.120.0040.01117.14
7.2.110.0080.00417.16
7.2.100.0090.00517.12
7.2.90.0020.01117.30
7.2.80.0150.00716.48
7.2.70.0140.00716.56
7.2.60.0130.00716.74
7.2.50.0120.01116.55
7.2.40.0150.00616.45
7.2.30.0160.00316.49
7.2.20.0130.00616.38
7.2.10.0090.00916.49
7.2.00.0100.00717.46
7.1.250.0080.00515.97
7.1.200.0030.00915.98
7.1.190.0290.01214.25
7.1.180.0150.01214.19
7.1.170.0390.00314.13
7.1.160.0230.00613.95
7.1.150.0190.00814.12
7.1.140.0230.00414.05
7.1.130.0190.00613.85
7.1.120.0180.00516.63
7.1.110.0160.00516.39
7.1.100.0080.00816.98
7.1.90.0120.00616.45
7.1.80.0460.00416.13
7.1.70.0110.00916.40
7.1.60.0190.01028.19
7.1.50.0180.00928.00
7.1.40.0210.01027.97
7.1.30.0180.01027.92
7.1.20.0170.00927.96
7.1.10.0090.01015.93
7.1.00.0100.00716.03
7.0.310.0990.00313.75
7.0.300.0320.00713.88
7.0.290.0230.00813.79
7.0.270.0250.00413.75
7.0.260.0190.00816.11
7.0.250.0150.00615.94
7.0.240.0150.00615.73
7.0.230.0180.01016.06
7.0.220.0120.00915.75
7.0.210.0190.00215.32
7.0.200.0160.00415.69
7.0.190.0100.00715.92
7.0.180.0100.01015.49
7.0.170.0070.01115.68
7.0.160.0060.01015.58
7.0.150.0120.00515.57
7.0.140.0110.00615.58
7.0.130.0140.00515.76
7.0.120.0130.00515.78
7.0.110.0160.00515.63
7.0.100.0120.00615.65
7.0.90.0130.00815.55
7.0.80.0100.00815.55
7.0.70.0130.00715.51
7.0.60.0110.00715.56
7.0.50.0080.00915.61
7.0.40.0140.00815.04
7.0.30.0110.00715.03
7.0.20.0070.00915.08
7.0.10.0080.00714.90
7.0.00.0110.00715.08
5.6.300.0080.03218.52
5.6.290.0100.03218.79
5.6.280.0140.03818.89
5.6.270.0030.03718.83
5.6.260.0080.03618.87
5.6.250.0170.03018.89
5.6.240.0150.03118.76
5.6.230.0040.03918.76
5.6.220.0080.03518.80
5.6.210.0080.03618.95
5.6.200.0090.03518.84
5.6.190.0060.03718.76
5.6.180.0130.03218.68
5.6.170.0070.03618.93
5.6.160.0130.03018.71
5.6.150.0090.04318.78
5.6.140.0080.03518.87
5.6.130.0090.03518.76
5.6.120.0080.03718.88
5.6.110.0110.03118.68
5.6.100.0130.03318.83
5.6.90.0090.03218.65
5.6.80.0080.03318.24
5.6.70.0070.03618.29
5.6.60.0100.02918.36
5.6.50.0080.04018.21
5.6.40.0090.02918.23
5.6.30.0090.03118.41
5.6.20.0060.03918.34
5.6.10.0060.03218.46
5.6.00.0090.03218.30
5.5.380.0100.02915.44
5.5.370.0130.02715.54
5.5.360.0100.03115.47
5.5.350.0080.03215.44
5.5.340.0070.03115.74
5.5.330.0110.03115.68
5.5.320.0090.02915.86
5.5.310.0100.02915.83
5.5.300.0130.02715.88
5.5.290.0070.03515.76
5.5.280.0060.03415.72
5.5.270.0060.03415.91
5.5.260.0130.03015.75
5.5.250.0080.03115.71
5.5.240.0080.02915.43
5.5.230.0070.03315.30
5.5.220.0070.03015.38
5.5.210.0070.03215.36
5.5.200.0070.03015.41
5.5.190.0060.03415.27
5.5.180.0090.02815.39
5.5.160.0060.03015.41
5.5.150.0050.03215.26
5.5.140.0030.03615.30
5.5.130.0040.03215.41
5.5.120.0070.03015.36
5.5.110.0080.02815.18
5.5.100.0070.03115.21
5.5.90.0090.02815.26
5.5.80.0060.03215.38
5.5.70.0090.04315.21
5.5.60.0100.02815.19
5.5.50.0080.02915.28
5.5.40.0070.03015.36
5.5.30.0080.02915.22
5.5.20.0060.03115.08
5.5.10.0080.03515.20
5.5.00.0080.02915.22
5.4.450.0100.02515.37
5.4.440.0100.02515.40
5.4.430.0090.02615.36
5.4.420.0090.02715.13
5.4.410.0070.02815.33
5.4.400.0060.02715.04
5.4.390.0100.02515.10
5.4.380.0120.02115.05
5.4.370.0070.02714.90
5.4.360.0080.02615.15
5.4.350.0060.03015.04
5.4.340.0150.01915.16
5.4.320.0090.02715.03
5.4.310.0130.02215.16
5.4.300.0030.03415.11
5.4.290.0070.02815.21
5.4.280.0050.02815.22
5.4.270.0060.03015.29
5.4.260.0080.02915.13
5.4.250.0120.02215.19
5.4.240.0140.02215.21
5.4.230.0080.02615.04
5.4.220.0080.02515.14
5.4.210.0120.02115.13
5.4.200.0070.02615.18
5.4.190.0060.02715.18
5.4.180.0050.02814.87
5.4.170.0090.02515.15
5.4.160.0100.02315.18
5.4.150.0080.02815.06
5.4.140.0120.02114.16
5.4.130.0080.02513.87
5.4.120.0080.02313.97
5.4.110.0090.02313.93
5.4.100.0100.02413.94
5.4.90.0080.02314.09
5.4.80.0120.02113.92
5.4.70.0080.02613.82
5.4.60.0070.02513.96
5.4.50.0120.02014.00
5.4.40.0070.02414.05
5.4.30.0130.02713.99
5.4.20.0110.02013.85
5.4.10.0140.02014.07
5.4.00.0110.02113.59
5.3.290.0120.02212.37
5.3.280.0110.02212.58
5.3.270.0110.02412.32
5.3.260.0050.02912.32
5.3.250.0070.02512.58
5.3.240.0120.02012.46
5.3.230.0060.02712.47
5.3.220.0090.02312.46
5.3.210.0100.02412.44
5.3.200.0110.02112.31
5.3.190.0080.02512.57
5.3.180.0070.02612.64
5.3.170.0120.02112.42
5.3.160.0050.02612.37
5.3.150.0100.02212.52
5.3.140.0130.02012.57
5.3.130.0100.02212.45
5.3.120.0070.02612.50
5.3.110.0120.02112.48
5.3.100.0120.02012.22
5.3.90.0110.02012.30
5.3.80.0080.02312.15
5.3.70.0090.02312.19
5.3.60.0110.02112.31
5.3.50.0090.02212.13
5.3.40.0030.02812.21
5.3.30.0130.01812.16
5.3.20.0060.02412.06
5.3.10.0140.01811.99
5.3.00.0050.02511.84
5.2.170.0060.02010.32
5.2.160.0070.01910.22
5.2.150.0050.02010.33
5.2.140.0070.02110.29
5.2.130.0020.02410.17
5.2.120.0010.02510.31
5.2.110.0030.02310.11
5.2.100.0060.01910.32
5.2.90.0040.02110.15
5.2.80.0070.01810.21
5.2.70.0070.01810.08
5.2.60.0100.01610.07
5.2.50.0070.01810.25
5.2.40.0040.02010.32
5.2.30.0080.01810.17
5.2.20.0050.0199.90
5.2.10.0040.02210.06
5.2.00.0030.0219.84
5.1.60.0020.0199.57
5.1.50.0080.0169.45
5.1.40.0080.0139.50
5.1.30.0060.0169.73
5.1.20.0020.0209.72
5.1.10.0100.0139.58
5.1.00.0030.0199.53
5.0.50.0060.0129.03
5.0.40.0000.0189.03
5.0.30.0030.0229.03
5.0.20.0060.0169.03
5.0.10.0050.0139.03
5.0.00.0080.0159.03
4.4.90.0020.0129.03
4.4.80.0000.0149.03
4.4.70.0020.0139.03
4.4.60.0030.0129.03
4.4.50.0030.0129.03
4.4.40.0070.0139.03
4.4.30.0060.0099.03
4.4.20.0050.0099.03
4.4.10.0030.0119.03
4.4.00.0030.0179.03
4.3.110.0040.0119.03
4.3.100.0080.0099.03
4.3.90.0030.0139.03
4.3.80.0060.0139.03
4.3.70.0030.0109.03
4.3.60.0010.0129.03
4.3.50.0020.0129.03
4.3.40.0000.0189.03
4.3.30.0010.0129.03
4.3.20.0050.0089.03
4.3.10.0030.0109.03
4.3.00.0020.0119.03

preferences:
67.11 ms | 403 KiB | 5 Q