Guest User

Untitled

a guest
Oct 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. <?php
  2.  
  3. $listSort[] = array('email' => 'a@b.c', 'name' => 'x', 'umur' => 21);
  4. $listSort[] = array('email' => 'a2@b.c', 'name' => 'y', 'umur' => 11);
  5. $listSort[] = array('email' => 'a3@b.c', 'name' => 'z', 'umur' => 33);
  6.  
  7. foreach ($listSort as $key => $row) {
  8. $name2[$key] = $row['name'];
  9. $umur2[$key] = $row['umur'];
  10. }
  11.  
  12. array_multisort($umur2, SORT_DESC, $name2, SORT_ASC, $listSort);
  13.  
  14. echo '<pre>';
  15. echo print_r($listSort);
  16. echo '</pre>';
Add Comment
Please, Sign In to add comment