3v4l.org

run code in 300+ PHP versions simultaneously
<?php $aUserFiles = [ 0 => [ 'file' => 'file 1', 'semesters' => [ 3 ] ], 1 => [ 'file' => 'file 2', 'semesters' => [ 3,4 ] ], 2 => [ 'file' => 'file 3', 'semesters' => [ 1,2 ] ], 3 => [ 'file' => 'file 4', 'semesters' => [ 3,4,5,6 ] ] ]; $requiredSemesters = 3; $indicators = []; $result = []; foreach ($aUserFiles as $key => $file) { $first = $file['semesters'][0]; $last = $file['semesters'][count($file['semesters']) - 1]; $filesInRangeCount = count(array_intersect($file['semesters'], range(1, $requiredSemesters))); if (!isset($indicators[$first]) || $indicators[$first]['range'] < $filesInRangeCount) { $indicators[$first] = ["key" => $key, "max" => $last, "range" => $filesInRangeCount]; } } ksort($indicators); $result = []; $max = 0; foreach ($indicators as $indicator) { if ($max >= $requiredSemesters) { break; } $result[] = $aUserFiles[$indicator['key']]; $max = $indicator["max"]; } print_r($result);

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.5.30.0130.00319.54
8.5.20.0090.00719.34
8.5.10.0100.00816.57
8.5.00.0130.00919.89
8.4.180.0110.01023.69
8.4.170.0150.00822.52
8.4.160.0110.01123.93
8.4.150.0050.00216.82
8.4.140.0120.01017.49
8.4.130.0140.00618.89
8.4.120.0130.00624.05
8.4.110.0100.01022.39
8.4.100.0100.01018.58
8.4.90.0080.01318.84
8.4.80.0040.00418.71
8.4.70.0050.00317.80
8.4.60.0110.00918.59
8.4.50.0030.00618.50
8.4.40.0140.00719.48
8.4.30.0100.01017.67
8.4.20.0070.00418.63
8.4.10.0160.00019.55
8.3.300.0110.01020.81
8.3.290.0110.00920.77
8.3.280.0170.00620.07
8.3.270.0140.00616.62
8.3.260.0090.01016.49
8.3.250.0130.00617.07
8.3.240.0140.00517.07
8.3.230.0160.00416.54
8.3.220.0140.00418.89
8.3.210.0100.00818.47
8.3.200.0090.00516.69
8.3.190.0090.00417.41
8.3.180.0110.00718.27
8.3.170.0110.00717.07
8.3.160.0090.00918.54
8.3.150.0090.01117.18
8.3.140.0000.01417.29
8.3.130.0080.00018.42
8.3.120.0060.00318.78
8.3.110.0070.00420.94
8.3.100.0060.00324.06
8.3.90.0030.00526.77
8.3.80.0030.00616.75
8.3.70.0110.01118.55
8.3.60.0090.00918.55
8.3.50.0120.00418.35
8.3.40.0070.01418.88
8.3.30.0070.00718.67
8.3.20.0080.00019.14
8.3.10.0040.00421.94
8.3.00.0040.00420.75
8.2.300.0120.00923.82
8.2.290.0110.00920.39
8.2.280.0060.00218.35
8.2.270.0080.00017.09
8.2.260.0050.00318.88
8.2.250.0040.00416.46
8.2.240.0210.00019.11
8.2.230.0060.00922.58
8.2.220.0000.01637.54
8.2.210.0040.00426.77
8.2.200.0060.00316.75
8.2.190.0120.00316.58
8.2.180.0040.01416.63
8.2.170.0120.00622.96
8.2.160.0110.00322.05
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0070.01020.01
8.2.110.0000.01022.24
8.2.100.0040.00817.72
8.2.90.0080.00017.63
8.2.80.0070.00318.92
8.2.70.0000.00817.38
8.2.60.0030.00617.63
8.2.50.0040.00417.75
8.2.40.0080.00018.13
8.2.30.0040.00418.02
8.2.20.0000.00718.21
8.2.10.0080.00018.14
8.2.00.0000.00817.62
8.1.340.0100.01017.61
8.1.330.0110.00721.85
8.1.320.0130.00615.99
8.1.310.0090.00918.56
8.1.300.0060.00317.61
8.1.290.0030.00618.88
8.1.280.0100.01025.92
8.1.270.0080.00021.78
8.1.260.0040.01226.35
8.1.250.0070.00028.09
8.1.240.0030.00619.14
8.1.230.0070.00419.22
8.1.220.0060.00317.88
8.1.210.0040.00418.77
8.1.200.0080.00017.38
8.1.190.0110.00816.88
8.1.180.0060.00318.10
8.1.170.0060.00318.50
8.1.160.0040.00419.00
8.1.150.0000.00918.95
8.1.140.0040.00422.13
8.1.130.0080.00020.26
8.1.120.0060.00617.48
8.1.110.0000.00717.46
8.1.100.0000.00717.51
8.1.90.0050.00217.42
8.1.80.0000.00817.41
8.1.70.0040.00717.44
8.1.60.0000.00917.43
8.1.50.0060.00617.54
8.1.40.0000.00817.51
8.1.30.0000.00817.69
8.1.20.0050.00317.70
8.1.10.0040.00417.43
8.1.00.0040.00417.52
8.0.300.0030.00521.85
8.0.290.0040.00416.75
8.0.280.0030.00318.44
8.0.270.0040.00417.27
8.0.260.0060.00018.48
8.0.250.0000.00716.85
8.0.240.0000.00716.96
8.0.230.0040.00416.85
8.0.220.0030.00316.73
8.0.210.0070.00016.89
8.0.200.0040.00416.84
8.0.190.0070.00016.85
8.0.180.0040.00416.92
8.0.170.0060.00316.80
8.0.160.0050.00216.91
8.0.150.0060.00416.84
8.0.140.0040.00416.75
8.0.130.0070.00013.28
8.0.120.0080.00016.79
8.0.110.0080.00016.70
8.0.100.0000.00716.95
8.0.90.0040.00416.76
8.0.80.0070.01216.87
8.0.70.0000.00716.78
8.0.60.0050.00216.78
8.0.50.0040.00416.76
8.0.30.0110.00817.08
8.0.20.0200.01017.40
8.0.10.0020.00516.86
8.0.00.0070.01116.75
7.4.330.0020.00215.55
7.4.320.0000.00616.43
7.4.300.0070.00016.41
7.4.290.0030.00316.63
7.4.280.0040.00416.49
7.4.270.0030.00316.52
7.4.260.0000.00816.59
7.4.250.0040.00416.51
7.4.240.0000.00716.51
7.4.230.0040.00416.39
7.4.220.0020.00516.63
7.4.210.0040.01416.61
7.4.200.0040.00416.52
7.4.160.0080.00816.39
7.4.140.0110.00717.86
7.4.130.0090.00916.48
7.4.120.0130.00716.54
7.4.110.0070.01016.61
7.4.100.0060.01116.59
7.4.90.0110.00616.62
7.4.80.0060.01619.39
7.4.70.0170.00016.45
7.4.60.0030.01216.47
7.4.50.0070.01116.62
7.4.40.0040.01116.37
7.4.00.0090.00814.88
7.3.330.0000.00513.13
7.3.320.0050.00013.13
7.3.310.0000.00816.49
7.3.300.0030.00316.34
7.3.290.0070.00016.35
7.3.280.0040.01116.25
7.3.260.0110.01016.59
7.3.240.0100.00816.49
7.3.230.0130.01016.59
7.3.210.0100.00716.57
7.3.200.0060.01016.43
7.3.190.0090.00916.59
7.3.180.0150.00016.45
7.3.170.0070.01716.55
7.3.160.0030.01316.49
7.3.120.0110.00714.96
7.3.110.0120.00714.84
7.3.100.0070.00515.05
7.3.90.0010.01114.85
7.3.80.0050.00814.91
7.3.70.0070.00814.75
7.3.60.0020.01114.62
7.3.50.0060.00614.71
7.3.40.0080.00814.80
7.3.30.0070.00714.55
7.3.20.0050.01116.70
7.3.10.0090.00316.57
7.3.00.0060.00616.70
7.2.330.0100.00716.65
7.2.320.0110.00716.86
7.2.310.0100.00716.59
7.2.300.0070.01416.74
7.2.290.0060.01016.70
7.2.250.0070.01314.91
7.2.240.0050.01415.08
7.2.230.0070.00815.28
7.2.220.0100.00714.96
7.2.210.0070.00915.20
7.2.200.0080.00914.97
7.2.190.0040.00914.98
7.2.180.0080.00615.07
7.2.170.0080.01015.11
7.2.110.1010.01014.83
7.2.100.0900.00714.30
7.2.90.1380.00514.55
7.2.80.0480.01114.64
7.2.70.0900.01015.01
7.2.60.0890.00215.08
7.2.50.0880.00515.13
7.2.40.0620.00714.62
7.2.30.0250.00915.00
7.2.20.0540.00815.04
7.2.10.0270.01015.00
7.2.00.0620.00714.53
7.1.330.0030.01215.75
7.1.320.0050.00915.72
7.1.310.0070.00515.65
7.1.300.0040.00815.54
7.1.290.0110.00515.80
7.1.280.0060.00415.79
7.1.270.0080.00315.77
7.1.260.0030.00915.89
7.1.230.0780.00713.78
7.1.220.0610.01313.77
7.1.210.1200.01313.75
7.1.200.0970.01113.81
7.1.190.0870.00913.86
7.1.180.0390.01413.83
7.1.170.0810.00513.76
7.1.160.0470.00813.85
7.1.150.0380.01213.73
7.1.140.0220.01114.03
7.1.130.0210.00313.63
7.1.120.0230.00813.76
7.1.110.0190.00713.75
7.1.100.0530.00913.95
7.1.90.0590.00914.05
7.1.80.0490.00113.90
7.1.70.0810.00513.54
7.1.60.1000.01431.80
7.1.50.1330.00331.66
7.1.40.1200.01531.76
7.1.30.0270.01331.61
7.1.20.0820.00731.71
7.1.10.0310.00813.65
7.1.00.0700.00713.63
5.6.380.0090.00914.32

preferences:
100.47 ms | 1676 KiB | 5 Q