3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fillStart = new DateTime("2019-07-23 00:15:00"); $fillEnd = new DateTime("2019-09-23 13:00:00"); $gapStart = new DateTime("2019-05-23 00:15:00"); $gapEnd = new DateTime("2019-06-23 13:00:00"); // // 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 %28s -> %28s\n", $fillStart->format($f), $fillEnd->format($f)); printf("Gap %28s -> %28s\n", $gapStart->format($f), $gapEnd->format($f)); printf("New %28s -> %28s\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.0070.01116.75
8.3.60.0070.01716.75
8.3.50.0140.00616.48
8.3.40.0180.00021.13
8.3.30.0040.01118.64
8.3.20.0070.00024.18
8.3.10.0080.00024.66
8.3.00.0040.00426.16
8.2.180.0120.00325.92
8.2.170.0060.01219.06
8.2.160.0110.00422.96
8.2.150.0030.00525.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00426.35
8.2.110.0060.00320.65
8.2.100.0110.00017.97
8.2.90.0050.00318.03
8.2.80.0080.00018.00
8.2.70.0080.00017.75
8.2.60.0080.00018.05
8.2.50.0030.00718.07
8.2.40.0080.00018.35
8.2.30.0040.00418.20
8.2.20.0000.00718.03
8.2.10.0040.00419.46
8.2.00.0000.00719.46
8.1.280.0110.00425.92
8.1.270.0040.00423.99
8.1.260.0030.00528.09
8.1.250.0040.00428.09
8.1.240.0080.00420.88
8.1.230.0060.00621.09
8.1.220.0040.00417.89
8.1.210.0030.00618.80
8.1.200.0080.00317.48
8.1.190.0040.00417.47
8.1.180.0040.00418.10
8.1.170.0030.00518.66
8.1.160.0000.00818.97
8.1.150.0040.00418.89
8.1.140.0000.00719.00
8.1.130.0000.00720.16
8.1.120.0000.00817.79
8.1.110.0040.00417.75
8.1.100.0030.00617.62
8.1.90.0040.00417.79
8.1.80.0030.00617.61
8.1.70.0000.00717.65
8.1.60.0050.00317.77
8.1.50.0000.00817.61
8.1.40.0040.00417.71
8.1.30.0040.00817.79
8.1.20.0070.00017.74
8.1.10.0050.00317.75
8.1.00.0060.00317.76
8.0.300.0060.00320.08
8.0.290.0040.00416.88
8.0.280.0040.00418.61
8.0.270.0000.00718.27
8.0.260.0000.00618.61
8.0.250.0070.00017.09
8.0.240.0030.00317.20
8.0.230.0000.00717.22
8.0.220.0000.00717.09
8.0.210.0040.00417.21
8.0.200.0030.00317.21
8.0.190.0000.00817.12
8.0.180.0070.00017.11
8.0.170.0040.00417.07
8.0.160.0000.00717.25
8.0.150.0070.00017.06
8.0.140.0000.00717.16
8.0.130.0030.00313.57
8.0.120.0050.00317.18
8.0.110.0000.00717.16
8.0.100.0050.00316.97
8.0.90.0000.00717.23
8.0.80.0110.00417.21
8.0.70.0050.00317.22
8.0.60.0000.00717.16
8.0.50.0040.00417.17
8.0.30.0090.00917.34
8.0.20.0120.00717.39
8.0.10.0000.00717.09
8.0.00.0110.01116.99
7.4.330.0000.00515.55
7.4.320.0030.00316.73
7.4.300.0060.00316.82
7.4.290.0040.00416.70
7.4.280.0070.00016.84
7.4.270.0000.00716.66
7.4.260.0000.00613.37
7.4.250.0040.00416.67
7.4.240.0000.01016.83
7.4.230.0040.00416.62
7.4.220.0030.00416.76
7.4.210.0110.00516.79
7.4.200.0050.00316.82
7.4.130.0100.00816.75
7.4.120.0030.02416.59
7.4.110.0060.01216.79
7.4.100.0100.00716.67
7.4.90.0090.01316.67
7.4.80.0090.01216.82
7.4.70.0160.00616.58
7.4.60.0060.01516.70
7.4.50.0140.00716.68
7.4.40.0040.01816.66
7.4.30.0080.01416.97
7.4.20.0140.00716.85
7.4.10.0150.00616.91
7.4.00.0130.00716.56
7.3.330.0000.00716.43
7.3.320.0000.00613.34
7.3.310.0000.00716.61
7.3.300.0000.00716.56
7.3.290.0110.00616.57
7.3.280.0140.00616.36
7.3.260.0070.01116.80
7.3.230.0100.00716.60
7.3.220.0070.01016.72
7.3.210.0120.00916.39
7.3.200.0190.00316.82
7.3.190.0070.01416.53
7.3.180.0210.00016.50
7.3.170.0170.00516.46
7.3.160.0180.00416.57
7.3.150.0120.01016.60
7.3.140.0110.01416.81
7.3.130.0180.00716.43
7.3.120.0170.00416.43
7.3.110.0150.00616.34
7.3.100.0090.01316.49
7.3.90.0160.00516.43
7.3.80.0090.01716.64
7.3.70.0090.00616.57
7.3.60.0130.00316.55
7.3.50.0100.00716.61
7.3.40.0030.01316.51
7.3.30.0030.01316.79
7.3.20.0130.00616.63
7.3.10.0130.00316.48
7.3.00.0130.00316.68
7.2.330.0110.01117.07
7.2.320.0140.00716.53
7.2.310.0140.00716.72
7.2.300.0100.01316.95
7.2.290.0170.00816.97
7.2.280.0130.00916.96
7.2.270.0130.01016.63
7.2.260.0200.00316.81
7.2.250.0160.00816.96
7.2.240.0160.00716.99
7.2.230.0110.01116.71
7.2.220.0090.01417.05
7.2.210.0100.00716.79
7.2.200.0110.00716.82
7.2.190.0140.00416.77
7.2.180.0090.00916.84
7.2.170.0100.00716.89
7.2.160.0000.01916.62
7.2.150.0090.01116.74
7.2.140.0110.00716.87
7.2.130.0150.00616.90
7.2.120.0070.01116.86
7.2.110.0070.01116.96
7.2.100.0090.00916.91
7.2.90.0110.00616.64
7.2.80.0120.00616.76
7.2.70.0150.00417.00
7.2.60.0140.00516.80
7.2.50.0060.01216.91
7.2.40.0120.00916.98
7.2.30.0490.01316.95
7.2.20.0090.00916.88
7.2.10.0030.01416.83
7.2.00.0120.00616.86

preferences:
57.07 ms | 400 KiB | 5 Q