Advertisement
Guest User

Untitled

a guest
Apr 13th, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2. $new = [
  3. '111' => [
  4. 'position' => 1,
  5. 'user' => 'Test1',
  6. 'shift' => 0
  7. ],
  8. '222' => [
  9. 'position' => 2,
  10. 'user' => 'Test2',
  11. 'shift' => 0
  12. ],
  13. '333' => [
  14. 'position' => 2,
  15. 'user' => 'Test3',
  16. 'shift' => 0
  17. ],
  18. '444' => [
  19. 'position' => 2,
  20. 'user' => 'Test4',
  21. 'shift' => 0
  22. ],
  23. '555' => [
  24. 'position' => 3,
  25. 'user' => 'Test5',
  26. 'shift' => 0
  27. ]
  28. ];
  29.  
  30. $new[111]['shift'] = -1;
  31.  
  32. array_multisort(array_column($new, 'shift'), SORT_DESC, SORT_NUMERIC, $new);
  33.  
  34. print_r($new);
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement