3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['type' => 'F'], ['type' => 'C'], ['Bar'], ['type' => 'B'], ['type' => 'H'], ['type' => 'D'], ['Foo'], ['type' => 'D'], ['A', 'B', 'C'], ['type' => 'F'], ['type' => 'Foo'], ['type' => 'Bar'], ['type' => 'A'], ['type' => 'E'], ['type' => 'Bar'], ]; $priorities = [ 'A' => 8, 'B' => 7, 'C' => 6, 'D' => 5, 'E' => 4, 'F' => 3, 'G' => 2, 'H' => 1, ]; function arraySortPriority(array &$array, $column, array $priorities):void { usort($array, function($a, $b) use ($column, $priorities) { $aFocus = $a[$column] ?? null; $bFocus = $b[$column] ?? null; return [array_key_exists($column, $b), $priorities[$bFocus] ?? 0, $aFocus] <=> [array_key_exists($column, $a), $priorities[$aFocus] ?? 0, $bFocus]; }); } arraySortPriority($array, 'type', $priorities); 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.140.0160.00717.38
8.4.130.0130.00817.94
8.4.120.0150.00520.70
8.4.110.0060.00422.53
8.4.100.0110.01017.88
8.4.90.0130.00720.70
8.4.80.0060.00218.89
8.4.70.0080.01120.55
8.4.60.0110.00918.95
8.4.50.0140.00620.34
8.4.40.0070.01120.42
8.4.30.0110.00418.80
8.4.20.0000.01722.57
8.4.10.0040.00721.18
8.3.270.0100.00916.84
8.3.260.0070.00216.53
8.3.250.0130.00619.09
8.3.240.0110.00716.93
8.3.230.0120.00816.62
8.3.220.0130.00519.00
8.3.210.0030.00418.64
8.3.200.0060.00316.77
8.3.190.0110.00717.13
8.3.180.0080.00517.05
8.3.170.0050.00320.80
8.3.160.0040.00417.29
8.3.150.0060.01217.16
8.3.140.0040.00716.63
8.3.130.0130.00618.41
8.3.120.0030.00619.00
8.3.110.0040.00416.80
8.3.100.0130.00616.88
8.3.90.0060.00316.52
8.3.80.0030.00619.36
8.3.70.0110.00718.05
8.3.60.0040.01116.61
8.3.50.0250.00823.63
8.3.40.0100.00320.39
8.3.30.0110.00318.67
8.3.20.0000.00824.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0040.00620.44
8.2.280.0130.00718.55
8.2.270.0120.00617.55
8.2.260.0070.01118.35
8.2.250.0050.00316.92
8.2.240.0140.00416.70
8.2.230.0090.00620.94
8.2.220.0030.00624.06
8.2.210.0110.00726.77
8.2.200.0000.00816.75
8.2.190.0100.01018.30
8.2.180.0090.00625.92
8.2.170.0140.00718.79
8.2.160.0100.00322.96
8.2.150.0070.00025.66
8.2.140.0070.00024.66
8.2.130.0000.00726.16
8.2.120.0040.00426.35
8.2.110.0080.00020.38
8.2.100.0120.00017.91
8.2.90.0000.00820.45
8.2.80.0070.00317.97
8.2.70.0000.00818.03
8.2.60.0060.00318.09
8.2.50.0040.00418.10
8.2.40.0040.00419.30
8.2.30.0030.00619.21
8.2.20.0000.00818.09
8.2.10.0040.00419.36
8.2.00.0000.00819.30
8.1.330.0120.00722.22
8.1.320.0110.00816.30
8.1.310.0090.00618.41
8.1.300.0120.00616.51
8.1.290.0060.00618.88
8.1.280.0120.00325.92
8.1.270.0030.00623.95
8.1.260.0040.00428.09
8.1.250.0080.00028.09
8.1.240.0070.00323.72
8.1.230.0040.00720.67
8.1.220.0040.00417.79
8.1.210.0000.00719.04
8.1.200.0070.00317.48
8.1.190.0080.00017.35
8.1.180.0000.00818.10
8.1.170.0040.00418.70
8.1.160.0070.00018.91
8.1.150.0000.00718.78
8.1.140.0040.00418.89
8.1.130.0070.00020.19
8.1.120.0030.00317.45
8.1.110.0030.00517.46
8.1.100.0000.00717.46
8.1.90.0050.00317.43
8.1.80.0060.00617.39
8.1.70.0070.00017.44
8.1.60.0050.00317.63
8.1.50.0080.00317.47
8.1.40.0090.00017.55
8.1.30.0050.00317.72
8.1.20.0050.00317.64
8.1.10.0000.00817.59
8.1.00.0070.00317.39
8.0.300.0040.00419.82
8.0.290.0040.00416.75
8.0.280.0030.00318.51
8.0.270.0000.00716.87
8.0.260.0040.00418.45
8.0.250.0070.00017.00
8.0.240.0020.00517.00
8.0.230.0030.00316.99
8.0.220.0080.00016.83
8.0.210.0030.00316.88
8.0.200.0000.00717.00
8.0.190.0000.00716.93
8.0.180.0070.00016.99
8.0.170.0000.00916.94
8.0.160.0040.00816.95
8.0.150.0000.00716.95
8.0.140.0000.00716.86
8.0.130.0030.00313.34
8.0.120.0040.00416.97
8.0.110.0000.00716.92
8.0.100.0020.00516.99
8.0.90.0040.00416.91
8.0.80.0110.00716.96
8.0.70.0000.00916.84
8.0.60.0000.00716.95
8.0.50.0040.00416.91
8.0.30.0090.00917.32
8.0.20.0160.00517.10
8.0.10.0000.00717.13
8.0.00.0130.00816.81
7.4.330.0000.00515.55
7.4.320.0040.00416.62
7.4.300.0030.00316.65
7.4.290.0040.00416.52
7.4.280.0080.00216.55
7.4.270.0030.00316.53
7.4.260.0000.00513.23
7.4.250.0030.00316.52
7.4.240.0040.00416.50
7.4.230.0000.00716.70
7.4.220.0010.00616.50
7.4.210.0050.00816.63
7.4.200.0000.00816.26
7.4.130.0120.01116.57
7.4.120.0110.00916.51
7.4.110.0160.00516.50
7.4.100.0150.01216.65
7.4.90.0170.01116.56
7.4.80.0230.01016.35
7.4.70.0210.00616.49
7.4.60.0200.00716.53
7.4.50.0180.01016.55
7.4.40.0170.00816.65
7.4.30.0210.00616.58
7.4.20.0200.00616.43
7.4.10.0190.00716.47
7.4.00.0140.01216.55
7.3.330.0000.00716.18
7.3.320.0030.00313.23
7.3.310.0030.00316.37
7.3.300.0070.00016.38
7.3.290.0060.01116.36
7.3.260.0040.01216.32
7.3.250.0140.00516.44
7.3.240.0150.00616.50
7.3.230.0150.00316.51
7.3.220.0140.01216.37
7.3.210.0180.01116.33
7.3.200.0180.01016.60
7.3.190.0140.01416.38
7.3.180.0150.01016.39
7.3.170.0210.00816.45
7.3.160.0190.00616.46
7.3.150.0200.00716.41
7.3.140.0150.01116.48
7.3.130.0170.00916.43
7.3.120.0170.01116.30
7.3.110.0250.00216.48
7.3.100.0190.01016.40
7.3.90.0210.01216.31
7.3.80.0150.01216.18
7.3.70.0170.00716.31
7.3.60.0150.01016.29
7.3.50.0200.00316.32
7.3.40.0080.01716.39
7.3.30.0110.01316.27
7.3.20.0170.00916.28
7.3.10.0120.01316.35
7.3.00.0160.01016.33
7.2.340.0160.01616.64
7.2.330.0240.01116.46
7.2.320.0220.01016.60
7.2.310.0200.00916.65
7.2.300.0210.01016.38
7.2.290.0190.00816.37
7.2.280.0180.01116.28
7.2.270.0220.00716.47
7.2.260.0190.00816.29
7.2.250.0200.01116.57
7.2.240.0150.01216.43
7.2.230.0240.00816.37
7.2.220.0140.01416.52
7.2.210.0180.01216.62
7.2.200.0190.00916.55
7.2.190.0250.00516.30
7.2.180.0130.01416.46
7.2.170.0190.01016.46
7.2.160.0150.01116.38
7.2.150.0130.01416.44
7.2.140.0220.00516.51
7.2.130.0220.00516.44
7.2.120.0150.01216.57
7.2.110.0180.01016.59
7.2.100.0200.01016.58
7.2.90.0240.00716.45
7.2.80.0150.01616.40
7.2.70.0220.00916.45
7.2.60.0220.01216.49
7.2.50.0220.00916.55
7.2.40.0210.01016.57
7.2.30.0180.01516.46
7.2.20.0370.01216.51
7.2.10.0160.01616.39
7.2.00.0180.01216.43

preferences:
30.81 ms | 403 KiB | 5 Q