3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['id' => 7867867, 'title' => 'Some Title'], ['id' => 3452342, 'title' => 'Some Title'], ['id' => 'foo', 'title' => 'Some Title'], ['id' => 1231233, 'title' => 'Some Title'], ['id' => 'bar', 'title' => 'Some Title'], ['id' => 5867867, 'title' => 'Some Title'] ]; // restructure with values as keys, and keys as order (ASC) $order = array_flip([3452342, 5867867, 7867867, 1231233]); // generating $order = [3452342 => 0, 5867867 => 1, 7867867 => 2, 1231233 => 3]; $default = count($order); // generating $default = 4 usort($array, function($a, $b) use($order, $default) { return strnatcmp( isset($order[$a['id']]) ? $order[$a['id']] : $default, isset($order[$b['id']]) ? $order[$b['id']] : $default ); }); 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.0130.00817.67
8.4.120.0070.00324.20
8.4.110.0060.00822.59
8.4.100.0100.00917.84
8.4.90.0110.00920.44
8.4.80.0130.00419.02
8.4.70.0050.00317.83
8.4.60.0160.00420.40
8.4.50.0110.00817.73
8.4.40.0110.01117.89
8.4.30.0200.00020.36
8.4.20.0090.01217.89
8.4.10.0000.00924.17
8.3.260.0100.00916.65
8.3.250.0130.00619.20
8.3.240.0080.01117.17
8.3.230.0050.00416.66
8.3.220.0110.00718.94
8.3.210.0080.01016.92
8.3.200.0060.00416.63
8.3.190.0060.00918.77
8.3.180.0090.00819.13
8.3.170.0120.00618.74
8.3.160.0070.01116.58
8.3.150.0150.00319.17
8.3.140.0080.00017.29
8.3.130.0100.01018.57
8.3.120.0090.00020.84
8.3.110.0000.01020.94
8.3.100.0070.00324.06
8.3.90.0050.01026.77
8.3.80.0060.00316.75
8.3.70.0150.00016.63
8.3.60.0040.01116.50
8.3.50.0120.00319.90
8.3.40.0120.00620.01
8.3.30.0110.00718.67
8.3.20.0000.00824.18
8.3.10.0040.00424.66
8.3.00.0090.00026.16
8.2.290.0050.00320.58
8.2.280.0130.00722.19
8.2.270.0200.00016.74
8.2.260.0130.00617.41
8.2.250.0030.01316.75
8.2.240.0130.00318.79
8.2.230.0000.00822.58
8.2.220.0060.00337.54
8.2.210.0000.00826.77
8.2.200.0030.00618.29
8.2.190.0090.00618.41
8.2.180.0140.00325.92
8.2.170.0040.01118.76
8.2.160.0200.00022.96
8.2.150.0070.00025.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0020.00520.79
8.2.110.0080.00020.39
8.2.100.0120.00017.84
8.2.90.0030.00519.22
8.2.80.0050.00317.97
8.2.70.0040.00417.50
8.2.60.0030.00517.91
8.2.50.0000.00818.10
8.2.40.0040.00422.21
8.2.30.0040.00418.21
8.2.20.0050.00320.72
8.2.10.0000.00818.10
8.2.00.0030.00519.24
8.1.330.0150.00522.25
8.1.320.0150.00416.32
8.1.310.0110.00416.85
8.1.300.0030.00618.14
8.1.290.0100.00030.84
8.1.280.0120.00425.92
8.1.270.0080.00024.66
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0100.00323.90
8.1.230.0070.00420.95
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0030.00717.38
8.1.190.0000.00817.23
8.1.180.0080.00018.10
8.1.170.0040.00418.70
8.1.160.0040.00422.05
8.1.150.0000.00818.61
8.1.140.0030.00517.39
8.1.130.0000.00917.48
8.1.120.0000.00817.52
8.1.110.0030.00517.58
8.1.100.0030.00617.64
8.1.90.0030.00617.53
8.1.80.0060.00317.48
8.1.70.0050.00317.60
8.1.60.0050.00317.54
8.1.50.0050.00317.52
8.1.40.0090.00017.56
8.1.30.0000.00917.73
8.1.20.0090.00017.68
8.1.10.0050.00317.57
8.1.00.0060.00317.56
8.0.300.0040.00418.77
8.0.290.0000.00716.58
8.0.280.0070.00018.45
8.0.270.0040.00416.89
8.0.260.0050.00516.95
8.0.250.0060.00316.95
8.0.240.0050.00316.95
8.0.230.0050.00316.95
8.0.220.0000.00716.95
8.0.210.0000.00716.95
8.0.200.0040.00416.95
8.0.190.0050.00316.95
8.0.180.0040.00416.95
8.0.170.0030.00316.95
8.0.160.0000.00716.95
8.0.150.0100.00016.95
8.0.140.0000.00716.95
8.0.130.0060.00316.95
8.0.120.0040.00416.95
8.0.110.0030.00616.95
8.0.100.0070.00216.95
8.0.90.0100.00016.95
8.0.80.0030.00616.95
8.0.70.0090.00016.95
8.0.60.0100.00016.95
8.0.50.0060.00316.95
8.0.30.0000.01016.95
8.0.20.0060.00316.95
8.0.10.0040.00417.00
5.6.400.0010.00616.95
5.4.450.0100.00720.94

preferences:
35.63 ms | 403 KiB | 5 Q