3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['id' => 7867867, 'lock' => 0, 'score' => 322, 'strtotime' => 16614713], ['id' => 7867867, 'lock' => 0, 'score' => 444, 'strtotime' => 16614613], ['id' => 7867867, 'lock' => 3, 'score' => 0, 'strtotime' => 16613713], ['id' => 7867867, 'lock' => 0, 'score' => 11, 'strtotime' => 16612713], ['id' => 7867867, 'lock' => 5, 'score' => 0, 'strtotime' => 16614413], ['id' => 7867867, 'lock' => 0, 'score' => 42, 'strtotime' => 16614113], ['id' => 7867867, 'lock' => 0, 'score' => 22, 'strtotime' => 16614013], ]; $maxIndex = count($array) - 1; for ($a = 0; $a < $maxIndex; ++$a) { if ($array[$a]['lock'] !== 0) { continue; // cannot move locked row } for ($b = 0; $b < $maxIndex; ++$b) { if ($array[$b]['lock'] !== 0) { continue; // cannot move locked row } // find next movable row for ($c = $b + 1; $c <= $maxIndex; ++$c) { if ($array[$c]['lock'] === 0) { break; // $c is index of non-locked row } } if ($c > $maxIndex) { break; // no more movable rows } // sort movable rows if ( $array[$b]['score'] > $array[$c]['score'] || ($array[$b]['score'] === $array[$c]['score'] && $array[$b]['strtotime'] > $array[$c]['strtotime']) ) { [$array[$b], $array[$c]] = [$array[$c], $array[$b]]; } } } var_export($array);

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.0150.00517.75
8.4.120.0120.00820.91
8.4.110.0110.00922.48
8.4.100.0120.00917.85
8.4.90.0120.00818.84
8.4.80.0050.00318.02
8.4.70.0140.00717.85
8.4.60.0020.00618.96
8.4.50.0120.00817.93
8.4.40.0130.00620.53
8.4.30.0030.00620.39
8.4.20.0070.00717.80
8.4.10.0000.01024.00
8.3.260.0090.00916.64
8.3.250.0100.00818.97
8.3.240.0130.00616.44
8.3.230.0130.00716.42
8.3.220.0050.00217.01
8.3.210.0100.00816.53
8.3.200.0030.00616.34
8.3.190.0110.00518.95
8.3.180.0050.00216.45
8.3.170.0160.00320.84
8.3.160.0040.00418.82
8.3.150.0140.00417.23
8.3.140.0140.00016.60
8.3.130.0110.00416.71
8.3.120.0030.00618.75
8.3.110.0090.00016.65
8.3.100.0040.00418.48
8.3.90.0000.00826.77
8.3.80.0080.00016.75
8.3.70.0150.00016.63
8.3.60.0040.01118.55
8.3.50.0140.00018.36
8.3.40.0070.01320.34
8.3.30.0110.00418.67
8.3.20.0090.00624.18
8.3.10.0040.00424.66
8.3.00.0030.00626.16
8.2.290.0060.01220.47
8.2.280.0130.00618.21
8.2.270.0080.00017.19
8.2.260.0110.00716.49
8.2.250.0080.00017.05
8.2.240.0000.01017.11
8.2.230.0040.00420.94
8.2.220.0070.01124.06
8.2.210.0000.00726.77
8.2.200.0060.00318.16
8.2.190.0160.00616.63
8.2.180.0120.00325.92
8.2.170.0040.01118.92
8.2.160.0170.00322.96
8.2.150.0080.00025.66
8.2.140.0080.00024.66
8.2.130.0140.00426.16
8.2.120.0140.00021.13
8.2.110.0060.00321.05
8.2.100.0060.00617.90
8.2.90.0040.00417.91
8.2.80.0030.00519.14
8.2.70.0030.00517.75
8.2.60.0000.00817.38
8.2.50.0040.00418.05
8.2.40.0050.00319.94
8.2.30.0040.00418.21
8.2.20.0040.00419.21
8.2.10.0000.00818.02
8.2.00.0040.00419.38
8.1.330.0110.00921.68
8.1.320.0120.00716.31
8.1.310.0110.00718.70
8.1.300.0070.00316.43
8.1.290.0090.00030.84
8.1.280.0090.01325.92
8.1.270.0050.00324.66
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0030.00622.14
8.1.230.0080.00320.87
8.1.220.0040.00417.78
8.1.210.0040.00418.84
8.1.200.0030.00617.22
8.1.190.0000.00817.23
8.1.180.0060.00318.10
8.1.170.0040.00417.62
8.1.160.0080.00018.99
8.1.150.0040.00418.54
8.1.140.0000.00817.48
8.1.130.0070.00018.91
8.1.120.0060.00317.48
8.1.110.0020.00517.46
8.1.100.0000.00817.42
8.1.90.0080.00317.45
8.1.80.0060.00817.36
8.1.70.0130.00317.35
8.1.60.0170.00217.49
8.1.50.0110.00817.40
8.1.40.0120.00717.45
8.1.30.0150.00417.66
8.1.20.0120.00717.64
8.1.10.0140.00517.53
8.1.00.0110.00717.40
8.0.300.0070.00020.08
8.0.290.0040.00416.63
8.0.280.0030.00518.46
8.0.270.0000.00716.80
8.0.260.0030.00318.39
8.0.250.0030.00317.00
8.0.240.0000.00716.96
8.0.230.0040.00416.96
8.0.220.0030.00316.83
8.0.210.0130.00116.77
8.0.200.0020.01416.86
8.0.190.0140.00216.87
8.0.180.0120.00316.83
8.0.170.0050.00916.79
8.0.160.0100.00616.79
8.0.150.0120.00316.83
8.0.140.0050.00916.79
8.0.130.0090.00616.81
8.0.120.0080.00616.76
8.0.110.0110.00416.77
8.0.100.0110.00316.76
8.0.90.0110.00416.78
8.0.80.0120.00316.87
8.0.70.0070.00816.74
8.0.60.0130.00316.80
8.0.50.0120.00416.82
8.0.30.0120.00316.85
8.0.20.0120.00216.84
8.0.10.0090.00716.98
7.4.330.0000.00615.55
7.4.320.0040.00416.40
7.4.300.0080.00916.52
7.4.290.0170.00116.38
7.4.280.0070.00716.47
7.4.270.0110.00516.57
7.4.260.0090.00716.47
7.4.250.0100.00516.50
7.4.240.0140.00316.43
7.4.230.0130.00316.50
7.4.220.0080.00616.44
7.4.210.0070.00716.48
7.4.200.0070.00716.49
7.4.190.0130.00116.51
7.4.180.0100.00416.52
7.4.160.0090.00416.43
7.4.150.0110.00316.58
7.4.140.0090.00616.33
7.4.130.0110.00516.44
7.4.120.0100.00416.35
7.4.110.0090.00616.42
7.4.100.0080.00716.49
7.4.90.0090.00516.38
7.4.80.0120.00316.42
7.4.70.0100.00516.41
7.4.60.0070.00716.41
7.4.50.0120.00316.32
7.4.40.0150.00016.36
7.4.30.0070.00616.42
7.4.20.0080.00516.43
7.4.10.0090.00516.41
7.4.00.0070.00816.40

preferences:
27.33 ms | 403 KiB | 5 Q