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', '18:30-18:45']]; function timeslotsToTimeline($timeslots) { $timeline = []; foreach ($timeslots as $timeslot) { $intTimes = sscanf(str_replace(':', '', $timeslot), "%d-%d"); $timeline[$intTimes[0]] = $intTimes[1]; } return $timeline; } function timelineToTimeslots($timeline) { $timeslots = []; foreach ($timeline as $start => $finish) { $timeslots[] = intdiv($start, 100) . ':' . substr($start, -2) . '-' . intdiv($finish, 100) . ':' . substr($finish, -2); } return $timeslots; } function intersectTimelines($timeline1, $timeline2) { $newTimeline = []; if (count($timeline1) > 0 && count($timeline2) > 0) { foreach ($timeline1 as $start1 => $finish1) { foreach ($timeline2 as $start2 => $finish2) { $newStart = max($start1, $start2); $newFinish = min($finish1, $finish2); if ($newStart < $newFinish) { $newTimeline[$newStart] = $newFinish; } } } } return $newTimeline; } $commonTimeline = timeslotsToTimeline(array_shift($openTimeslots)); foreach ($openTimeslots as $timeslots) { $newTimeline = timeslotsToTimeline($timeslots); $commonTimeline = intersectTimelines($commonTimeline, $newTimeline); } $commonTimeslots = timelineToTimeslots($commonTimeline); var_export($commonTimeslots);

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.0030.00617.64
8.4.120.0070.00320.66
8.4.110.0050.00418.93
8.4.100.0110.01017.93
8.4.90.0150.00518.84
8.4.80.0080.00117.77
8.4.70.0080.01317.84
8.4.60.0120.01018.83
8.4.50.0130.00917.95
8.4.40.0080.01117.79
8.4.30.0120.00920.13
8.4.20.0090.00924.28
8.4.10.0110.00917.60
8.3.260.0130.00616.55
8.3.250.0060.00318.67
8.3.240.0090.00716.76
8.3.230.0120.00716.63
8.3.220.0030.00517.13
8.3.210.0100.00716.92
8.3.200.0080.00116.61
8.3.190.0060.01116.86
8.3.180.0110.00916.74
8.3.170.0060.01319.10
8.3.160.0040.01418.24
8.3.150.0070.01120.78
8.3.140.0040.00416.69
8.3.130.0070.01318.36
8.3.120.0100.00719.00
8.3.110.0040.00416.90
8.3.100.0060.00316.62
8.3.90.0040.00426.77
8.3.80.0030.00616.88
8.3.70.0120.00916.58
8.3.60.0110.01118.43
8.3.50.0120.00619.89
8.3.40.0070.00721.01
8.3.30.0090.00618.57
8.3.20.0080.00024.18
8.3.10.0080.00024.66
8.3.00.0040.00426.16
8.2.290.0110.00822.09
8.2.280.0050.00518.37
8.2.270.0120.00617.37
8.2.260.0040.01118.46
8.2.250.0040.01118.29
8.2.240.0030.00617.18
8.2.230.0000.01020.94
8.2.220.0120.00624.06
8.2.210.0040.01526.77
8.2.200.0040.00418.07
8.2.190.0070.01416.75
8.2.180.0030.01125.92
8.2.170.0120.00619.00
8.2.160.0100.01022.96
8.2.150.0030.00625.66
8.2.140.0000.00824.66
8.2.130.0060.00326.16
8.2.120.0080.00026.16
8.2.110.0040.00422.30
8.2.100.0100.00317.84
8.2.90.0000.00817.88
8.2.80.0030.00618.90
8.2.70.0000.00817.75
8.2.60.0030.00517.63
8.2.50.0000.00817.75
8.2.40.0050.00317.63
8.2.30.0050.00317.79
8.2.20.0070.00018.08
8.2.10.0040.00419.18
8.2.00.0060.00319.25
8.1.330.0090.00622.10
8.1.320.0080.01116.13
8.1.310.0030.00518.35
8.1.300.0040.00419.61
8.1.290.0060.00330.84
8.1.280.0110.00725.92
8.1.270.0070.00023.99
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0100.00023.85
8.1.230.0040.00819.14
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0000.00917.35
8.1.190.0080.00317.22
8.1.180.0050.00318.10
8.1.170.0000.00717.65
8.1.160.0030.00319.05
8.1.150.0000.00718.54
8.1.140.0000.00717.43
8.1.130.0000.00718.84
8.1.120.0000.00717.39
8.1.110.0040.00417.40
8.1.100.0040.00417.38
8.1.90.0050.00317.53
8.1.80.0030.00617.52
8.1.70.0070.00017.45
8.1.60.0070.00017.63
8.1.50.0030.00717.45
8.1.40.0040.00417.52
8.1.30.0000.00817.70
8.1.20.0030.00517.64
8.1.10.0030.00517.60
8.1.00.0080.00017.43
8.0.300.0000.00818.77
8.0.290.0070.00016.63
8.0.280.0000.00718.09
8.0.270.0050.00316.86
8.0.260.0040.00418.52
8.0.250.0000.00716.93
8.0.240.0000.00716.95
8.0.230.0070.00017.05
8.0.220.0030.00516.84
8.0.210.0040.00416.86
8.0.200.0000.00816.91
8.0.190.0030.00616.95
8.0.180.0040.00416.85
8.0.170.0040.00416.96
8.0.160.0080.00016.98
8.0.150.0030.00516.88
8.0.140.0000.00716.88
8.0.130.0030.00313.34
8.0.120.0030.00516.89
8.0.110.0000.00716.89
8.0.100.0000.00716.87
8.0.90.0040.00416.83
8.0.80.0030.00316.90
8.0.70.0000.00716.95
8.0.60.0040.00416.77
8.0.50.0000.00716.99
8.0.30.0050.00216.76
8.0.20.0040.00416.98
8.0.10.0020.00516.93
8.0.00.0040.00416.97
7.4.330.0000.00515.55
7.4.320.0030.00316.61
7.4.300.0000.00616.50
7.4.290.0070.00016.43
7.4.280.0000.00916.64
7.4.270.0060.00316.52
7.4.260.0000.00613.30
7.4.250.0030.00516.48
7.4.240.0030.00316.65
7.4.230.0070.00016.30
7.4.220.0000.00716.66
7.4.210.0030.00516.48
7.4.200.0070.00016.62
7.4.190.0030.00316.45
7.4.180.0030.00316.64
7.4.160.0070.00016.57
7.4.150.0000.00716.47
7.4.140.0030.00316.27
7.4.130.0070.00016.49
7.4.120.0000.00816.21
7.4.110.0070.00016.43
7.4.100.0030.00316.50
7.4.90.0000.00716.57
7.4.80.0070.00016.19
7.4.70.0070.00016.56
7.4.60.0030.00316.54
7.4.50.0030.00316.36
7.4.40.0070.00016.40
7.4.30.0000.00816.47
7.4.20.0040.00416.57
7.4.10.0000.00816.42
7.4.00.0000.00716.58
7.3.330.0000.00716.35
7.3.320.0050.00013.19
7.3.310.0030.00316.21
7.3.300.0000.00816.23
7.3.290.0000.00716.23
7.3.280.0070.00016.21
7.3.270.0070.00016.32
7.3.260.0030.00316.34
7.3.250.0040.00416.36
7.3.240.0000.00616.38
7.3.230.0030.00316.30
7.3.220.0040.00416.32
7.3.210.0000.00816.26
7.3.200.0040.00416.15
7.3.190.0000.00816.14
7.3.180.0030.00616.27
7.3.170.0000.00816.14
7.3.160.0070.00016.29
7.3.150.0030.00316.19
7.3.140.0040.00416.16
7.3.130.0000.00716.29
7.3.120.0030.00316.27
7.3.110.0000.00716.16
7.3.100.0000.00616.09
7.3.90.0000.00716.50
7.3.80.0000.00716.15
7.3.70.0000.00716.32
7.3.60.0030.00316.32
7.3.50.0040.00416.37
7.3.40.0030.00316.50
7.3.30.0030.00316.41
7.3.20.0030.00318.28
7.3.10.0070.00418.10
7.3.00.0030.00618.09

preferences:
173.37 ms | 403 KiB | 5 Q