3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fillStart = new DateTime("2020-09-27 12:34:56"); $fillEnd = new DateTime("2020-10-10 12:34:56"); $gapStart = new DateTime("2020-09-09 01:02:03"); $gapEnd = new DateTime("2020-09-11 04:05:06"); // // being with the original start $fillStartModified = clone $fillStart; // move to the next weekday and time $wdtStart = $gapStart->format("l H:i:s"); if ($fillStartModified->format("l H:i:s") != $wdtStart) { $fillStartModified->modify("next {$wdtStart}"); } // get the duration, minus a bit so we can do a "next <day>" after $days = $gapStart->diff($gapEnd)->days - 1; // get the weekday and time $wdtEnd = $gapEnd->format("l H:i:s"); // update $fillEndModified = clone $fillStartModified; $fillEndModified->modify("+${days} days"); $fillEndModified->modify("next {$wdtEnd}"); $f = "l Y-m-d H:i:s"; printf("Fill %30s -> %30s\n", $fillStart->format($f), $fillEnd->format($f)); printf("Gap %30s -> %30s\n", $gapStart->format($f), $gapEnd->format($f)); printf("New %30s -> %30s\n", $fillStartModified->format($f), $fillEndModified->format($f));

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.0060.00918.81
8.3.60.0060.00916.75
8.3.50.0110.00816.45
8.3.40.0100.00721.22
8.3.30.0090.00618.96
8.3.20.0000.00824.18
8.3.10.0040.00424.66
8.3.00.0030.00526.16
8.2.180.0070.00725.92
8.2.170.0030.01419.29
8.2.160.0130.00322.96
8.2.150.0050.00325.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0090.00019.21
8.2.110.0100.00021.09
8.2.100.0080.00418.16
8.2.90.0040.00420.59
8.2.80.0040.00420.62
8.2.70.0030.00517.75
8.2.60.0000.00817.88
8.2.50.0000.00817.88
8.2.40.0000.00919.59
8.2.30.0000.00719.32
8.2.20.0040.00418.20
8.2.10.0000.00719.47
8.2.00.0040.00419.46
8.1.280.0140.00025.92
8.1.270.0000.00823.99
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0060.00322.18
8.1.230.0040.00820.92
8.1.220.0030.00617.78
8.1.210.0000.00919.07
8.1.200.0050.00317.47
8.1.190.0030.00517.35
8.1.180.0050.00318.10
8.1.170.0030.00517.63
8.1.160.0070.00019.17
8.1.150.0000.00719.04
8.1.140.0040.00418.97
8.1.130.0000.00720.27
8.1.120.0050.00217.63
8.1.110.0000.00817.63
8.1.100.0030.00617.74
8.1.90.0000.00717.71
8.1.80.0070.00317.59
8.1.70.0070.00017.79
8.1.60.0030.00517.77
8.1.50.0040.00417.73
8.1.40.0000.00817.58
8.1.30.0040.00417.84
8.1.20.0040.00417.82
8.1.10.0030.00617.71
8.1.00.0040.00417.69
8.0.300.0000.00720.07
8.0.290.0040.00417.00
8.0.280.0030.00318.62
8.0.270.0030.00317.02
8.0.260.0070.00018.59
8.0.250.0000.00717.25
8.0.240.0000.00717.22
8.0.230.0000.00717.08
8.0.220.0040.00417.26
8.0.210.0000.00717.16
8.0.200.0050.00217.13
8.0.190.0040.00417.18
8.0.180.0000.00717.20
8.0.170.0080.00417.21
8.0.160.0000.00717.16
8.0.150.0000.00717.04
8.0.140.0070.00017.08
8.0.130.0000.00513.55
8.0.120.0030.00517.11
8.0.110.0000.00817.11
8.0.100.0020.00517.04
8.0.90.0040.00417.12
8.0.80.0140.00717.14
8.0.70.0080.00017.11
8.0.60.0050.00317.02
8.0.50.0000.00917.01
8.0.30.0060.01017.20
8.0.20.0090.00917.39
8.0.10.0070.00017.38
8.0.00.0120.00616.93
7.4.330.0060.00015.55
7.4.320.0000.00616.67
7.4.300.0030.00316.81
7.4.290.0000.00816.80
7.4.280.0040.00416.66
7.4.270.0030.00316.72
7.4.260.0030.00313.41
7.4.250.0040.00416.65
7.4.240.0060.00316.77
7.4.230.0040.00416.63
7.4.220.0020.00616.87
7.4.210.0080.00816.82
7.4.200.0070.00016.91
7.4.130.0110.00816.75
7.4.120.0070.01016.86
7.4.110.0110.01116.61
7.4.100.0160.00616.75
7.4.90.0210.00416.48
7.4.80.0120.00616.79
7.4.70.0080.01116.85
7.4.60.0000.01816.87
7.4.50.0070.01116.70
7.4.40.0090.00916.61
7.4.30.0140.01116.50
7.4.20.0120.00916.80
7.4.10.0090.00916.68
7.4.00.0170.00316.79
7.3.330.0070.00016.60
7.3.320.0030.00313.45
7.3.310.0030.00316.60
7.3.300.0070.00016.40
7.3.290.0040.00416.57
7.3.280.0070.01416.54
7.3.260.0040.01416.77
7.3.230.0030.01716.55
7.3.220.0080.01116.52
7.3.210.0060.01916.63
7.3.200.0090.00916.61
7.3.190.0090.01016.91
7.3.180.0030.01616.55
7.3.170.0150.00916.70
7.3.160.0090.00916.56
7.3.150.0070.01116.56
7.3.140.0120.01216.89
7.3.130.0060.01216.73
7.3.120.0120.00616.61
7.3.110.0030.01616.57
7.3.100.0100.00916.62
7.3.90.0090.00916.60
7.3.80.0060.01316.57
7.3.70.0080.00816.44
7.3.60.0150.00616.39
7.3.50.0090.00916.48
7.3.40.0120.00916.26
7.3.30.0160.00716.80
7.3.20.0110.00616.68
7.3.10.0190.00016.51
7.3.00.0070.01116.58
7.2.330.0120.00916.72
7.2.320.0090.00917.02
7.2.310.0120.00916.73
7.2.300.0170.00416.79
7.2.290.0030.01617.11
7.2.280.0090.00916.98
7.2.270.0100.00916.79
7.2.260.0030.01516.73
7.2.250.0090.00916.79
7.2.240.0140.01316.80
7.2.230.0180.00316.61
7.2.220.0090.00916.67
7.2.210.0070.01017.04
7.2.200.0080.01116.55
7.2.190.0100.01316.57
7.2.180.0000.01916.73
7.2.170.0140.01016.66
7.2.160.0130.01216.79
7.2.150.0040.01216.79
7.2.140.0100.01016.66
7.2.130.0100.01316.78
7.2.120.0100.01216.88
7.2.110.0090.00916.69
7.2.100.0090.01216.89
7.2.90.0070.01416.77
7.2.80.0110.01516.91
7.2.70.0490.01316.85
7.2.60.0060.01916.64
7.2.50.0160.00916.66
7.2.40.0160.01016.69
7.2.30.0140.01116.86
7.2.20.0130.01017.06
7.2.10.0040.01617.00
7.2.00.0040.01516.96

preferences:
67.28 ms | 400 KiB | 5 Q