3v4l.org

run code in 300+ PHP versions simultaneously
<?php $openTimeslots = [ '02-09-2021' => [ '8:00-10:00', '16:00-19:00' ], '03-09-2021' => [ '7:00-10:00', '16:15-19:00', '14:00-16:00', '13:00-14:15' ], '04-09-2021' => [ '7:15-10:00', '15:15-18:15' ], '05-09-2021' => [ '8:15-8:45', '9:15-9:45', '16:15-19:00', ] ]; function slotToInts($slot) { return sscanf(str_replace(':', '', $slot), "%d-%d"); } $commons = array_map('slotToInts', array_shift($openTimeslots)); foreach ($openTimeslots as $slots) { $newCommons = []; foreach ($slots as $slot) { [$start, $end] = slotToInts($slot); foreach ($commons as [$commonStart, $commonEnd]) { $newCommonStart = null; $newCommonEnd = null; if ($start >= $commonStart && $start < $commonEnd) { $newCommonStart = $start; } if ($end > $commonStart && $end <= $commonEnd) { $newCommonEnd = $end; } if ($newCommonStart || $newCommonEnd) { $newCommons[] = [ $newCommonStart ?? $commonStart, $newCommonEnd ?? $commonEnd ]; } } } $commons = $newCommons; } var_export( array_map( fn($subarray) => implode('-', preg_replace('~(?=\d{2}(?:-|$))~', ':', $subarray)), $commons ) );

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.130.0060.00620.68
8.4.120.0120.00824.30
8.4.110.0040.00422.63
8.4.100.0150.00618.02
8.4.90.0030.00822.38
8.4.80.0060.00418.13
8.4.70.0150.00718.34
8.4.60.0080.01218.83
8.4.50.0080.01220.46
8.4.40.0040.01117.84
8.4.30.0070.01420.44
8.4.20.0030.01624.11
8.4.10.0130.00717.80
8.3.260.0110.00916.72
8.3.250.0100.00918.84
8.3.240.0030.00517.07
8.3.230.0110.00916.86
8.3.220.0060.00217.39
8.3.210.0020.00616.79
8.3.200.0060.00316.66
8.3.190.0120.00719.09
8.3.180.0140.00616.92
8.3.170.0060.01316.75
8.3.160.0130.00319.05
8.3.150.0060.01317.04
8.3.140.0070.01116.80
8.3.130.0080.00018.75
8.3.120.0060.00320.62
8.3.110.0040.00416.78
8.3.100.0090.00616.96
8.3.90.0110.00717.01
8.3.80.0060.00316.99
8.3.70.0130.00916.88
8.3.60.0190.00318.81
8.3.50.0170.00318.39
8.3.40.0000.01520.74
8.3.30.0090.00918.96
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0000.00726.16
8.2.290.0100.00820.43
8.2.280.0100.00918.46
8.2.270.0190.00016.70
8.2.260.0090.00018.79
8.2.250.0050.00317.07
8.2.240.0140.00317.28
8.2.230.0040.00420.94
8.2.220.0140.00024.06
8.2.210.0120.00626.77
8.2.200.0060.00317.00
8.2.190.0040.01116.88
8.2.180.0080.01125.92
8.2.170.0040.01119.21
8.2.160.0040.01122.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0110.00426.16
8.2.110.0040.00721.16
8.2.100.0000.01218.16
8.2.90.0000.00918.28
8.2.80.0000.00818.16
8.2.70.0050.00317.75
8.2.60.0030.00517.75
8.2.50.0060.00317.61
8.2.40.0000.00919.60
8.2.30.0000.00817.87
8.2.20.0040.00418.28
8.2.10.0040.00419.37
8.2.00.0050.00219.40
8.1.330.0120.00822.19
8.1.320.0080.01316.41
8.1.310.0030.00616.72
8.1.300.0030.00618.80
8.1.290.0040.00430.84
8.1.280.0070.01425.92
8.1.270.0080.00023.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00322.60
8.1.230.0130.00320.90
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0090.00017.48
8.1.190.0080.00017.12
8.1.180.0000.00818.10
8.1.170.0000.00817.76
8.1.160.0070.00019.12
8.1.150.0000.00718.66
8.1.140.0040.00417.53
8.1.130.0030.00318.97
8.1.120.0050.00217.63
8.1.110.0080.00017.69
8.1.100.0000.00717.55
8.1.90.0000.00817.52
8.1.80.0100.00017.63
8.1.70.0030.00517.61
8.1.60.0000.01017.80
8.1.50.0040.00417.58
8.1.40.0000.00917.65
8.1.30.0030.00517.65
8.1.20.0000.00817.79
8.1.10.0030.00517.74
8.1.00.0040.00417.70
8.0.300.0050.00319.98
8.0.290.0000.00716.88
8.0.280.0000.00818.19
8.0.270.0040.00417.10
8.0.260.0060.00018.53
8.0.250.0060.00017.20
8.0.240.0000.00717.08
8.0.230.0000.00717.14
8.0.220.0000.00717.08
8.0.210.0040.00417.09
8.0.200.0030.00517.24
8.0.190.0070.00317.22
8.0.180.0030.00517.15
8.0.170.0030.00617.15
8.0.160.0050.00217.00
8.0.150.0040.00417.13
8.0.140.0030.00917.10
8.0.130.0000.00613.59
8.0.120.0060.00316.99
8.0.110.0030.00617.11
8.0.100.0070.00017.05
8.0.90.0040.00416.93
8.0.80.0040.00417.07
8.0.70.0040.00416.97
8.0.60.0040.00417.06
8.0.50.0000.00716.99
8.0.30.0040.00416.97
8.0.20.0040.00417.24
8.0.10.0020.00516.98
8.0.00.0070.00017.18
7.4.330.0000.00515.55
7.4.320.0030.00316.80
7.4.300.0000.00616.82
7.4.290.0040.00416.75
7.4.280.0040.00416.64
7.4.270.0080.00016.65
7.4.260.0000.00613.48
7.4.250.0040.00416.68
7.4.240.0000.00816.87
7.4.230.0000.00716.78
7.4.220.0030.00316.73
7.4.210.0030.00316.78
7.4.200.0070.00016.66
7.4.190.0030.00316.84
7.4.180.0030.00316.80
7.4.160.0000.00716.75
7.4.150.0000.00716.76
7.4.140.0000.00716.61
7.4.130.0040.00416.79
7.4.120.0040.00416.51
7.4.110.0080.00016.75
7.4.100.0080.00016.93
7.4.90.0030.00516.63
7.4.80.0000.00716.79
7.4.70.0070.00016.83
7.4.60.0050.00316.87
7.4.50.0000.00716.45
7.4.40.0000.00716.42
7.4.30.0070.00016.45
7.4.20.0070.00016.54
7.4.10.0000.00716.64
7.4.00.0000.00716.68
7.3.330.0030.00315.99
7.3.320.0030.00313.28
7.3.310.0000.00716.29
7.3.300.0030.00316.12
7.3.290.0030.00316.11
7.3.280.0030.00316.16
7.3.270.0030.00316.11
7.3.260.0040.00416.10
7.3.250.0000.00616.14
7.3.240.0030.00316.03
7.3.230.0030.00316.11
7.3.220.0070.00015.94
7.3.210.0040.00416.07
7.3.200.0000.00616.07
7.3.190.0000.00715.91
7.3.180.0000.00816.05
7.3.170.0070.00015.92
7.3.160.0040.00416.08
7.3.150.0030.00616.05
7.3.140.0040.00416.05
7.3.130.0030.00316.10
7.3.120.0000.00616.08
7.3.110.0000.00616.05
7.3.100.0000.00715.98
7.3.90.0000.00716.23
7.3.80.0070.00015.98
7.3.70.0000.00616.07
7.3.60.0000.00716.15
7.3.50.0000.00616.09
7.3.40.0040.00416.03
7.3.30.0030.00316.18
7.3.20.0040.00417.85
7.3.10.0070.00018.03
7.3.00.0080.00017.95

preferences:
28.22 ms | 403 KiB | 5 Q