<?php
$array = Array
(
0 => Array
(
'user_id' => 10,
'id' => 1,
'Number' => 3,
'Active' => 1,
'Updated' => '2010-03-17 15:44:12',
),
1 => Array
(
'user_id' => 9,
'id' => 2,
'Number' => 2,
'Active' => 1,
'Updated' => '2010-03-17 15:44:12',
),
2 => Array
(
'user_id' => 8,
'id' => 3,
'Number' => 1,
'Active' => 1,
'Updated' => '2010-03-17 15:44:12',
)
);
array_multisort(array_map(function($element) {
return $element['user_id'];
}, $array), SORT_ASC, $array);
print_r($array);
- Output for 7.1.25 - 7.1.32, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.3
- Array
(
[0] => Array
(
[user_id] => 8
[id] => 3
[Number] => 1
[Active] => 1
[Updated] => 2010-03-17 15:44:12
)
[1] => Array
(
[user_id] => 9
[id] => 2
[Number] => 2
[Active] => 1
[Updated] => 2010-03-17 15:44:12
)
[2] => Array
(
[user_id] => 10
[id] => 1
[Number] => 3
[Active] => 1
[Updated] => 2010-03-17 15:44:12
)
)
preferences:
147.72 ms | 409 KiB | 5 Q