Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $new = [
- '111' => [
- 'position' => 1,
- 'user' => 'Test1',
- 'shift' => 0
- ],
- '222' => [
- 'position' => 2,
- 'user' => 'Test2',
- 'shift' => 0
- ],
- '333' => [
- 'position' => 2,
- 'user' => 'Test3',
- 'shift' => 0
- ],
- '444' => [
- 'position' => 2,
- 'user' => 'Test4',
- 'shift' => 0
- ],
- '555' => [
- 'position' => 3,
- 'user' => 'Test5',
- 'shift' => 0
- ]
- ];
- $new[111]['shift'] = -1;
- array_multisort(array_column($new, 'shift'), SORT_DESC, SORT_NUMERIC, $new);
- print_r($new);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement