3v4l.org

run code in 300+ PHP versions simultaneously
<?php $intervals = [ ['from_time' => '15:00', 'to_time' => '17:15'], ['from_time' => '10:00', 'to_time' => '12:15'], ['from_time' => '09:00', 'to_time' => '11:15'], ['from_time' => '09:00', 'to_time' => '11:15'], ['from_time' => '14:00', 'to_time' => '16:15'], ['from_time' => '15:00', 'to_time' => '17:15'], ]; $overlaps = []; foreach ($intervals as $interval) { $key = null; foreach ($overlaps as $_key => $_intervals) { foreach ($_intervals as $_interval) { if ( ($_interval['from_time'] <= $interval['from_time'] && $interval['from_time'] <= $_interval['to_time']) || ($_interval['from_time'] <= $interval['to_time'] && $interval['to_time'] <= $_interval['to_time']) ) { $key = $_key; break 2; } } } if (is_null($key)) { $key = count($overlaps); } $overlaps[$key][] = $interval; } foreach ($overlaps as &$overlap) { $from = '00:00'; $to = '23:59'; foreach ($overlap as $_interval) { $from = max($from, $_interval['from_time']); $to = min($to, $_interval['to_time']); } $overlap = ['from_time' => $from, 'to_time' => $to]; } unset($overlap); print_r($overlaps);

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.0100.01017.86
8.4.10.0070.01319.61
8.3.140.0060.00318.54
8.3.130.0040.00418.32
8.3.120.0060.00318.98
8.3.110.0000.01120.94
8.3.100.0030.00716.41
8.3.90.0150.00318.45
8.3.80.0090.00017.97
8.3.70.0150.00316.63
8.3.60.0100.01016.63
8.3.50.0070.00917.40
8.3.40.0110.00718.59
8.3.30.0170.00318.71
8.3.20.0050.00318.77
8.3.10.0000.00820.65
8.3.00.0080.00019.51
8.2.260.0110.00818.37
8.2.250.0050.00318.43
8.2.240.0140.00717.31
8.2.230.0000.00822.58
8.2.220.0040.00837.54
8.2.210.0000.00826.77
8.2.200.0060.00318.54
8.2.190.0090.00916.58
8.2.180.0110.00416.38
8.2.170.0180.00318.95
8.2.160.0110.00422.96
8.2.150.0070.00024.18
8.2.140.0000.00724.66
8.2.130.0040.00426.16
8.2.120.0080.00019.36
8.2.110.0060.00319.30
8.2.100.0090.00317.91
8.2.90.0080.00019.17
8.2.80.0000.00817.97
8.2.70.0040.00417.63
8.2.60.0000.00718.04
8.2.50.0030.00718.10
8.2.40.0040.00418.22
8.2.30.0030.00718.17
8.2.20.0000.00817.66
8.2.10.0050.00317.62
8.2.00.0000.00817.63
8.1.310.0040.00416.79
8.1.300.0040.00418.19
8.1.290.0090.00318.88
8.1.280.0070.01325.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0030.00619.26
8.1.230.0070.00417.70
8.1.220.0000.00817.79
8.1.210.0030.00518.77
8.1.200.0070.00317.38
8.1.190.0030.00517.23
8.1.180.0040.00418.10
8.1.170.0050.00318.87
8.1.160.0040.00418.90
8.1.150.0070.00018.71
8.1.140.0000.00817.50
8.1.130.0000.00817.84
8.1.120.0000.00817.43
8.1.110.0040.00417.49
8.1.100.0030.00417.46
8.1.90.0040.00417.39
8.1.80.0000.00717.52
8.1.70.0040.00417.46
8.1.60.0050.00517.61
8.1.50.0000.00817.49
8.1.40.0000.00717.44
8.1.30.0070.00017.64
8.1.20.0030.00617.67
8.1.10.0040.00417.50
8.1.00.0040.00417.35
8.0.300.0000.00718.77
8.0.290.0050.00216.63
8.0.280.0020.00518.48
8.0.270.0020.00516.89
8.0.260.0080.00016.87
8.0.250.0000.00716.88
8.0.240.0000.00916.88
8.0.230.0000.00716.87
8.0.220.0030.00316.84
8.0.210.0030.00316.91
8.0.200.0040.00416.98
8.0.190.0060.00516.84
8.0.180.0050.00216.88
8.0.170.0050.00316.93
8.0.160.0040.00416.97
8.0.150.0030.00616.89
8.0.140.0080.00016.84
8.0.130.0000.00513.39
8.0.120.0040.00416.79
8.0.110.0080.00016.70
8.0.100.0040.00416.93
8.0.90.0000.00716.90
8.0.80.0070.01016.89
8.0.70.0040.00416.97
8.0.60.0000.00716.89
8.0.50.0070.00016.85
8.0.30.0120.00717.12
8.0.20.0140.00817.24
8.0.10.0050.00317.01
8.0.00.0090.01217.01
7.4.330.0060.00012.91
7.4.320.0000.00616.54
7.4.300.0000.00716.51
7.4.290.0030.00316.50
7.4.280.0000.00716.42
7.4.270.0030.00316.52
7.4.260.0040.00413.25
7.4.250.0040.00416.44
7.4.240.0030.00516.57
7.4.230.0030.00316.65
7.4.220.0070.01416.37
7.4.210.0060.00916.56
7.4.200.0000.00716.43
7.4.190.0000.00716.54
7.4.160.0120.00616.51
7.4.150.0120.01216.71
7.4.140.0070.01016.54
7.4.130.0120.00516.60
7.4.120.0050.01216.42
7.4.110.0110.00616.74
7.4.100.0070.01016.65
7.4.90.0110.01116.38
7.4.80.0120.00616.56
7.4.70.0100.00716.37
7.4.60.0090.00816.51
7.4.50.0020.00216.19
7.4.40.0040.01116.61
7.4.30.0080.00816.63
7.4.00.0080.00914.93
7.3.330.0030.00313.26
7.3.320.0060.00013.24
7.3.310.0030.00316.22
7.3.300.0000.00716.33
7.3.290.0000.01516.38
7.3.280.0060.01016.38
7.3.270.0140.00316.55
7.3.260.0120.00616.33
7.3.250.0100.01216.41
7.3.240.0090.00616.67
7.3.230.0100.00716.67
7.3.210.0070.01016.30
7.3.200.0070.01019.39
7.3.190.0150.00716.29
7.3.180.0160.00616.39
7.3.170.0030.01316.46
7.3.160.0090.00616.67
7.3.120.0080.01014.99
7.3.110.0070.01114.85
7.3.100.0120.00315.17
7.3.90.0060.00914.93
7.3.80.0030.01014.86
7.3.70.0040.00814.93
7.3.60.0040.01114.80
7.3.50.0060.00914.64
7.3.40.0000.01714.61
7.3.30.0000.01214.66
7.3.20.0000.01616.48
7.3.10.0050.00816.67
7.3.00.0100.00416.58
7.2.330.0130.00416.50
7.2.320.0100.01316.45
7.2.310.0220.01316.55
7.2.300.0060.01016.63
7.2.290.0110.00716.80
7.2.250.0060.01015.09
7.2.240.0030.01015.27
7.2.230.0030.01414.91
7.2.220.0060.00915.03
7.2.210.0000.01515.02
7.2.200.0040.01114.76
7.2.190.0080.00815.23
7.2.180.0120.00615.02
7.2.170.0090.00015.21
7.2.130.0060.00916.91
7.2.120.0110.00417.07
7.2.110.0030.00716.94
7.2.100.0140.00016.84
7.2.90.0000.01417.04
7.2.80.0030.01417.00
7.2.70.0070.00716.87
7.2.60.0050.01116.85
7.2.50.0100.00016.84
7.2.40.0070.01116.93
7.2.30.0060.00916.92
7.2.20.0070.01017.13
7.2.10.0070.00716.62
7.2.00.0030.01316.82
7.1.330.0000.01515.72
7.1.320.0070.00716.01
7.1.310.0070.00716.06
7.1.300.0060.00915.90
7.1.290.0060.00315.61
7.1.280.0030.00616.00
7.1.270.0030.01515.86
7.1.260.0100.00315.79
7.1.250.0040.00415.84
7.1.200.0060.00915.91
7.1.100.0060.00617.91
7.1.70.0040.00417.01
7.1.60.0070.00317.03
7.1.50.0120.00434.60
7.1.00.0030.07322.32
7.0.200.0040.01116.96
7.0.140.0070.07021.95
7.0.120.0070.06022.12
7.0.110.0070.04021.75
7.0.100.0000.04721.87
7.0.90.0070.03721.74
7.0.80.0100.02721.86
7.0.70.0070.08021.64
7.0.60.0000.07721.80
7.0.50.0030.04021.66
7.0.40.0030.04019.74
7.0.30.0000.05019.78
7.0.20.0000.04319.87
7.0.10.0070.03319.85
7.0.00.0070.04019.58
5.6.280.0070.09021.10
5.6.260.0030.04020.63
5.6.250.0070.03720.89
5.6.240.0070.03720.68
5.6.230.0030.04020.72
5.6.220.0030.04020.61
5.6.210.0100.07720.71
5.6.200.0030.04320.57
5.6.190.0070.03720.58
5.6.180.0000.04320.66
5.6.170.0000.05720.45
5.6.160.0070.05720.63
5.6.150.0070.03720.69
5.6.140.0030.04020.69
5.6.130.0030.06720.84
5.6.120.0030.04020.66
5.6.110.0070.04020.60
5.6.100.0000.05020.67
5.6.90.0030.04020.64
5.6.80.0030.03720.02
5.6.70.0030.03719.94
5.6.60.0070.03719.94
5.6.50.0000.04020.07
5.6.40.0000.04020.00
5.6.30.0030.05319.83
5.6.20.0030.04719.98
5.6.10.0030.04019.98
5.6.00.0030.05719.95
5.5.380.0000.04017.66
5.5.370.0100.03717.69
5.5.360.0030.03717.51
5.5.350.0170.05017.60
5.5.340.0000.06718.11
5.5.330.0070.04318.12
5.5.320.0030.04017.91
5.5.310.0000.04318.25
5.5.300.0030.03718.25
5.5.290.0030.04017.93
5.5.280.0070.06317.91
5.5.270.0000.08317.91
5.5.260.0030.04017.92
5.5.250.0030.04017.89
5.5.240.0030.03717.57
5.5.230.0030.04317.45
5.5.220.0030.03717.42
5.5.210.0000.05017.30
5.5.200.0030.03317.54
5.5.190.0070.05317.55
5.5.180.0030.05317.48
5.5.160.0000.07717.42
5.5.150.0030.07717.45
5.5.140.0130.06317.28
5.5.130.0070.07317.43
5.5.120.0030.07717.17
5.5.110.0030.07717.25
5.5.100.0000.04717.36
5.5.90.0070.05017.16
5.5.80.0000.06717.16
5.5.70.0030.07317.34
5.5.60.0070.07317.46
5.5.50.0100.05717.46
5.5.40.0000.07717.34
5.5.30.0000.03717.11
5.5.20.0030.07317.49
5.5.10.0030.05317.45
5.5.00.0030.07717.16
5.4.450.0000.04019.51
5.4.440.0030.03719.63
5.4.430.0070.03719.33
5.4.420.0030.05319.32
5.4.410.0000.04719.23
5.4.400.0030.03719.03
5.4.390.0030.04319.04
5.4.380.0030.04019.33
5.4.370.0000.03719.00
5.4.360.0070.03019.00
5.4.350.0030.03718.95
5.4.340.0000.04018.98
5.4.320.0030.07319.18
5.4.310.0070.07019.18
5.4.300.0030.07718.98
5.4.290.0100.06718.99
5.4.280.0030.07719.14
5.4.270.0130.03319.23
5.4.260.0000.08019.18
5.4.250.0030.03719.33
5.4.240.0070.06319.33
5.4.230.0030.04719.00
5.4.220.0000.03719.00
5.4.210.0070.05018.98
5.4.200.0030.03319.16
5.4.190.0030.06719.00
5.4.180.0130.07319.30
5.4.170.0070.05719.15
5.4.160.0000.07319.11
5.4.150.0170.07019.21
5.4.140.0030.04016.43
5.4.130.0030.04716.33
5.4.120.0000.05716.31
5.4.110.0200.02716.65
5.4.100.0030.07316.27
5.4.90.0030.04716.46
5.4.80.0030.07316.50
5.4.70.0070.06716.25
5.4.60.0100.03316.44
5.4.50.0070.07316.45
5.4.40.0030.06716.52
5.4.30.0030.07316.23
5.4.20.0100.08016.52
5.4.10.0000.07016.46
5.4.00.0130.03316.01
5.3.290.0000.07714.75
5.3.280.0030.07314.48
5.3.270.0000.04714.63
5.3.260.0100.06014.63
5.3.250.0100.06314.63
5.3.240.0100.04014.62
5.3.230.0100.07314.60
5.3.220.0100.07314.39
5.3.210.0000.08014.49
5.3.200.0030.07014.45
5.3.190.0070.07014.41
5.3.180.0030.08014.66
5.3.170.0070.07314.39
5.3.160.0000.08014.39
5.3.150.0130.07314.63
5.3.140.0070.08014.50
5.3.130.0030.07714.44
5.3.120.0030.07314.45
5.3.110.0070.06714.61
5.3.100.0100.07013.89
5.3.90.0100.06013.89
5.3.80.0000.04013.80
5.3.70.0100.06014.02
5.3.60.0030.07713.86
5.3.50.0030.04714.04
5.3.40.0030.04014.04
5.3.30.0070.03313.97
5.3.20.0030.03313.61
5.3.10.0030.03313.54
5.3.00.0000.03713.64
5.2.170.0070.05311.21
5.2.160.0000.03711.08
5.2.150.0000.03011.21
5.2.140.0030.02711.13
5.2.130.0030.02711.05
5.2.120.0000.02711.00
5.2.110.0000.02711.01
5.2.100.0070.02011.02
5.2.90.0000.03011.02
5.2.80.0000.03311.05
5.2.70.0030.04310.99
5.2.60.0100.01710.99
5.2.50.0000.03010.90
5.2.40.0000.03310.93
5.2.30.0000.02710.88
5.2.20.0030.05010.88
5.2.10.0000.02710.98
5.2.00.0000.02710.64
5.1.60.0070.0409.93
5.1.50.0070.0179.93
5.1.40.0000.0279.87
5.1.30.0030.02710.25
5.1.20.0070.02010.49
5.1.10.0000.02310.12
5.1.00.0030.03710.05
5.0.50.0030.0209.75
5.0.40.0030.0209.75
5.0.30.0070.0539.75
5.0.20.0030.0439.75
5.0.10.0000.0479.75
5.0.00.0030.0639.75
4.4.90.0030.0139.75
4.4.80.0000.0239.75
4.4.70.0000.0209.75
4.4.60.0000.0139.75
4.4.50.0000.0139.75
4.4.40.0030.0339.75
4.4.30.0000.0209.75
4.4.20.0000.0139.75
4.4.10.0000.0209.75
4.4.00.0000.0279.75
4.3.110.0000.0379.75
4.3.100.0000.0209.75
4.3.90.0070.0309.75
4.3.80.0000.0539.75
4.3.70.0000.0309.75
4.3.60.0000.0179.75
4.3.50.0030.0309.75
4.3.40.0000.0509.75
4.3.30.0000.0179.75
4.3.20.0000.0239.75
4.3.10.0000.0209.75
4.3.00.0030.0209.75

preferences:
74.83 ms | 403 KiB | 5 Q